No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello Monks. I am a humble seeker of your wisdom.
I need help writing a RegExp that matches when two words both are present in a string, but the order is unknown. Also, the words might or might not be next to eachother. The regexp should NOT match when only one word is present. With nested if's it is trivial, but I would like to do it with a single regexp.
Example: If I have a file:
I wan't to match lines 1,2,6 and 7, but not 3 thorugh 5, using some match for foo and bar. Any idea?
Edit Masem 2001-11-13 - Changed title from 'Regular expression and' In reply to Regular expression for two required words by fsn
|
|