in reply to Help with Regular Expression matching
May be a little bit of an overkill, but does what you say you want ;-)
my $reg1 = qr{((?:(?<=<)ab(?=>))|(?:(?<!<)ab(?!>)))}; while(<DATA>) { chomp; print $_, "\t", m/$reg1/?"yes $1":"no", "\n"; } __DATA__ <ab ab> <> <ab> ab __END__ Output: <ab no ab> no <> no <ab> yes ab ab yes ab
regards,
tomte
Hlade's Law:
If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.
|
|---|