christopherbarsuk has asked for the wisdom of the Perl Monks concerning the following question:
My Perl version (5.004?) doesn't seem to support the negative lookbehind regex extension (?<!PATTERN), but it does support the negative lookahead extension (?!PATTERN) ( my sysadmin is unwilling to upgrade Perl, so I'm stuck with this version).
I've come up with s/\b$input_string\b(?!')/$output_string/g (where $input_string = "input" and $output_string = "OUTPUT"), but that produces OUTPUT and 'input' and 'tinput' and ' input' and 'OUTPUT' and OUTPUT, which is not quite right.
I've tried a bunch of other code as well, none of which works correctly... Anybody have any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: complex pattern matching
by tachyon (Chancellor) on Aug 18, 2001 at 11:40 UTC | |
by christopherbarsuk (Acolyte) on Aug 19, 2001 at 01:53 UTC | |
|
Re: complex pattern matching
by lemming (Priest) on Aug 18, 2001 at 12:46 UTC |