in reply to regexp help -- word boundaries

$n =~ s/^(\s*)$a(\s*)$/$1$b$2/i;