How can I solve this Java regex problem?
Input:
some heading text... ["fds afsa","fwr23423","42df f","1a_4(211@#","3240acg!g"] some trailing text....
Problem: I would like to capture everything between the double quotes. (Example: fds afsa, fwr23423, etc.)
I have tried the following pattern:
\[(?:"([^"]+)",?)+\]
But when performing a Matcher.find(), it will result in a StackOverflowError, when using a larger input (but does work for a small input, this is a bug in Java). And even if it did work, then matcher.group(1) will only give "3240acg!g".
How can I solve this issue? (Or is the use of multiple patterns required, where the first pattern strips the brackets?)
Get string between [ ]
and then split by comma. It's much easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With