As an input I’ve got a plain SQL query smth like:
select * from (
select * from Table where id in (1,2,3,4,5,6,642,7,8,9)
or another_id in (1,2,3,4,5,6, 34 ,7 , 8,9))
where yet_another_id in (1,2)
I want to find all IN clause statements where the amount of arguments passed in is greater than XXX.
So far I’ve came up with this solution.
^.*\s*+(?:in)+\s*+(\((?:\s*+\d+\s*+\,?+){XXX,}+\){1}).*$
where XXX is the number of arguments.
Obviously, the first part:
^.*
eats all IN clause statements except the last one. How can I fix that? Any suggestions how can I improve the regex?
Try this here
So I removed some stuff from your expression and fixed an obvious error
(\(?:where you escaped the wrong bracket.The
\bis a word boundary.This is working now for me here on Regexr