Do you know where your variables are? | |
PerlMonks |
look-behind regexby zejames (Hermit) |
on Jul 24, 2002 at 05:27 UTC ( [id://184706]=perlquestion: print w/replies, xml ) | Need Help?? |
zejames has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks, Here is my problem : I want to substitute a word, 'foo', by another word 'bar' in a line, but only if that line does not contain 'toto' before matching 'foo'. Of course, I can do this : Output:
But what I am looking for is an only regex, probably using look-behing assertion. I have played with (?<!pattern), without success. As far as I understand, the problem is that there can be anything between 'toto' and 'foo'. Any hint ? -- zejames
Back to
Seekers of Perl Wisdom
|
|