This is the FAQ list for #regex
How do I parse HTML/XML?
How do I match a URL?
How do I match text which doesn't match a pattern?
How do I negate a match?
Ideally, you'll want to use the features of your language or application software to do this. Here are some examples:
If you cannot use such a technique because your application (e.g. a text editor) does not allow that level of programmability, you may be able to get by with an expression such as:
Note however that this may be much slower than the equivalent negated expression.
How do I match text which contains words in any order?
How do I match text which matches more than one pattern?
This is another of those situations where regular expressions alone are not enough. The best way is to match the line against multiple patterns:
/foo/ && $str
Again, if you cannot use such a technique, try