Given the following sample input:
rgb(97, 0, 255) none repeat scroll 0% 0% / auto padding-box border-box
I'm trying to split this string right after the closing bracket with the following regex:
string.split("\\)\\s")[0]
Problem is that this approach is chopping off the bracket:
rgb(97, 0, 255
How can I get the following output?
rgb(97, 0, 255)
How do I split without chopping off the closing bracket?
CodePudding user response:
You may need a Positive Lookbehind, which will look for what's before your match, yet without matching it:
(?<=\))\s
Check the demo here.