[Tutor] I'm drawing a blank on a simple (?) regex
R. Alan Monroe
amonroe at columbus.rr.com
Tue May 23 19:21:45 CEST 2006
> R. Alan Monroe wrote:
>> I'm searching through SQL logs and want to find lines that have
>> WHERE-less (unbounded) queries. I can't come up with a regex to say:
>>
>> SELECT.*FROM.*(the word WHERE must not exist anywhere in the remainder
>> of the line)
>>
>> Am I forgetting something simple or would this take two passes?
> Try using a negative look-ahead:
> SELECT.*FROM(?!.*WHERE)
Brilliant - works in python redemo, and grep too w/ -P switch.
Alan
More information about the Tutor
mailing list