Following is the string I am using
(((Thermal) WN RR) AND ((Energy) SS AB)), Text only
Above text need to be converted to
Thermal AND Energy
How to achieve this. This should be generic like this should also work if the value is
((Thermal) WN TR)
((Thermal) WN RR) AND ((Energy) SS AB) OR ((Thermal) WN RR)
Any help would be greatly appreciated. Thanks in advance
Solution: Thank to @spOOm Using his regex, following is the code I used to solve the issue
q = <Query String>
q = q.substring(0, q.lastIndexOf(')')+1);
q = q.replace(/\(\(([^()]+)\)(?: [^()]+)+\)/g, "$1");
The first setup could be done by Regex but I am not a pro at regex. Thank you all..