I am currently using a regex to find all the operators which are not in double quotes as:
(?<operator> [A-Z]+ (?=([^\"]*\"[^\"]*\")*[^\"]*$))
It is working fine as it matches one " OR " and one " AND " in the following expression.
method(ARG,"No AND Yes OR other") OR method(ARG,ARG) AND method(ARG,ARG)
As you can view here: https://regex101.com/r/8S0uLN/2
The problem is, when I use the following text with the above regex it will match the operators inside parenthesis also:
method(ARG,"No AND Yes OR other") OR (method(ARG,ARG) AND method(method(ARG),ARG))
I am expecting only one operator match in above string, which is " OR ". Which is not in a double quote and not in any parenthesis.
Please have a look here: https://regex101.com/r/92tD8R/2
Please let me know what I need place in regex to not match the operators in parenthesis.
Comments
Post a Comment