Reputation: 2042
I need a RegEx pattern which matches from "where" to the end of the line (\n
). For example, these would match:
"where x = 5\n"
"where x = 5 and y = 6\n"
"where (x = 5) and (y = 6) or (z = 7)\n"
So basically the pattern must start with "where" and end with a new-line character "\n".
EDIT: RegEx pattern will be used in a Ruby (on Rails) project...
Upvotes: 0
Views: 108
Reputation:
\bwhere\s(.*)$ The ()
group what the predicate so you can extract it.
Upvotes: 0
Reputation: 72971
You didn't specify your language, but the following is pretty universal:
/\b(WHERE .*)$/i
$
is end of line. i
is the flag for case insensitive.
Upvotes: 1