My program parses a multi-line SQL VALUES string in a single-line array of strings.
A typical input line is as follows:
(11,'-1','Service A (nested parentheses)','en') (22,'-2','Service B (nested parentheses)','en')
Required Conclusion:
- group 1:
11,'-1','Service A (nested parentheses)','en' - group 2:
22,'-2','Service B (nested parentheses)','en'
I tried using regexp with partial luck:
\(('.*?'|.*?)\)
What would be the correct way to handle this in regexp?
EDIT:
- Target platform is Java 6/7
- No need to replace parentheses with a new line - only for capturing groups
Dan m source
share