Mar 26
Regular expressions are a good thing, but they are anything but simple. The basics are learned relatively quickly, but true to the motto "it's always worse", there are tasks in which one is quick with his wits' end.
In regular expressions which for me was always the negation of strings. An example is the Apache error_log to which one should always have one eye. But not everybody 'File does not exist' would like to be alerted.
Non-interest are such items as:
: 52 : 23 2010 ] [ error ] [ client 127.0.01 ] File does not exist: / var / www / foo / bar [Thu Mar 23 10: 52: 23 2010] [error] [client 127.0.01] File does not exist: / var / www / foo / bar
But fatal PHP errors should have noticed:
: 50 : 57 2010 ] [ error ] [ client 127.0.01 ] PHP Fatal error: foo bar [Tue Mar 24 16: 50: 57 2010] [error] [client 127.0.01] PHP Fatal error: foo bar
The solution is negative lookaheads (?!negativePattern) and for the above object could look like this:
\s\ [ client\s\S+ ] \s ( ? ! File\sdoes\snot\sexist ) \ [Error \] \ s \ [client \ s \ S +] \ s (? File \ sdoes \ snot \ sexist)
Finish.



