I know that this has been asked/answered several times but unfortunately none of the solutions I've tried so far works in my case. I need to split something like this:
contrast(200%) drop-shadow(rgba(0, 0, 0, 0.5) 0px 0px 10px)
into this:
contrast(200%)
drop-shadow(0px 0px 10px rgba(0,0,0,.5))
By following this solution, I'm currently doing this:
myString = "contrast(200%) drop-shadow(rgba(0, 0, 0, 0.5) 0px 0px 10px)"
myString.match(/[^\(\s]+(\(.*?\)+)?/g)
but this gives me:
contrast(200%)
drop-shadow(rgba(0, 0, 0, 0.5) <== notice the missing second ) here
0px <== unwanted, should go with previous one
0px <== unwanted, should go with previous one
10px) <== unwanted, should go with previous one
as the regexp does not capture all closing brackets...