Reputation: 89
I have a regexp that selects the columns from SQL query: \bwf\.[^,|^\s|^)]*
So from both queries
SELECT (wf.Name,
wf.Status)
SELECT wf.Name, wf.Status
it will return "wf.Name", "wf.Status". But also I want to cover case when column contains round brackets:
SELECT (wf.Name,
wf.Status())
regexp should return "wf.Name", "wf.Status()".
I tried to do it through non-capturing group (?:(?!\s|,|<statement>).)*
but without success.
Upvotes: 2
Views: 1866
Reputation: 626903
You can use
\bwf(?:\.\w+)+(?:\(\))?
See the regex demo. Details:
\b
- a word boundarywf
- a wf
string(?:\.\w+)+
- one or more repetitions of a .
and one or more word chars
(?:\(\))?
- an optional occurrence of a ()
substring.Upvotes: 1