S
S. Levent Yilmaz
Hello,
It sounded like a very simple problem but I couldn't come up with an
elegant solution. The problem is:
Find all lines which contain a given word (say 'kitty') not preceded
with another given word (say 'puppy') . For instance:
I have two pets:
my kitty is very cute
but puppy is cuter than kitty
What regular expression stands only for the 2nd line? Note that the
other way around is very easy, that is the lines with 'puppy' followed
by 'kitty' is only "puppy.*kitty"
Is this possible at all with a single RegExp?
thank you so very much!
-Levent.
It sounded like a very simple problem but I couldn't come up with an
elegant solution. The problem is:
Find all lines which contain a given word (say 'kitty') not preceded
with another given word (say 'puppy') . For instance:
I have two pets:
my kitty is very cute
but puppy is cuter than kitty
What regular expression stands only for the 2nd line? Note that the
other way around is very easy, that is the lines with 'puppy' followed
by 'kitty' is only "puppy.*kitty"
Is this possible at all with a single RegExp?
thank you so very much!
-Levent.