in reply to Defenetly a complicated perl recipie with 2 arrays, 1 scaler and some special matching
{ $topic =~ s/(^|\W)$_($|\W)/$1$2/g; }
update yea yea, my original code was fscked up badly .. that's what you get for looking at what edits need to be done at the same time...
that is, look for the word between either the start of the starting or a non-word character, and either the end of the string or a non-word character. You might end up with consecutive spaces in the topic this way; you may want to consider using a placeholder to indicate you removed something (something as simple as BLEEP), but that's up to your project specifications.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Defenetly a complicated perl recipie with 2 arrays, 1 scaler and some special matching
by Dominus (Parson) on Jul 15, 2001 at 06:49 UTC | |
by Anonymous Monk on Jul 15, 2001 at 06:54 UTC |