There may be a better way to do it though. Consider \b for word boundries.my $ariths = '(+*\-/<>=)%^'; $string =~ s/(?:^|(?<=[$ariths]))BAD(?=[$ariths])/HELL/g;
Update:Ugg, thanks Not_a_Number... corrected. I used a non-capturing paren when I meant to use a zero-width assertion.
Dave
In reply to Re: string substitution
by davido
in thread string substitution
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |