I have a complex string coming from the UI like:
(region = "asia") AND ((status = null) OR ((inactive = "true") AND (department = "aaaa")) OR ((costcenter = "ggg") OR (location = "india")))
I need to split it and use it in my code, but I have to take into consideration the braces so that grouping occurs exactly as shown. After split, I have to get something like the following in each iteration and break it down
First time:
(region = "asia") AND
((status = null) OR ((inactive = "true") AND (department = "aaaa")) OR ((costcenter = "ggg") OR (location = "india")))
Second time:
(region = "asia") AND
(
(status = null) OR
((inactive = "true") AND (department = "aaaa")) OR
((costcenter = "ggg") OR (location = "india"))
)
and so on...
Any pointers on how to achieve this?