Here is a regular expression pattern that can be used to find the operator in a SQL expression. For that matter any F=V type expression. Given a “field (operator) value” expression, this regex pattern will match and find the operator portion in strings such as…
field = value, field > value, field >=, field <= value, field value, etc..
Note – The above pattern worked for Java 1.6, and on other languages it maybe possible to remove so of the escape slashes in the “[=\\]” portion to “[=]”.
If you would like to find other RegEx patterns, I recommend GSkinner’s RegExr. Click the “community” tab on the right and you’ll discover a lot of useful patterns: