in reply to string substitution
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: string substitution
by Not_a_Number (Prior) on Oct 08, 2003 at 17:44 UTC | |
|
Re: Re: string substitution
by davido (Cardinal) on Oct 08, 2003 at 18:02 UTC |