0

How to split string on comma, except when comma is parameter separator or part of string?

for example:

one,"two","three[r,6]",four[6,5],"five,sex"

should be:

one

"two"

"three[r,6]"

four[6,5]

"five,sex"

I have something like this https://regex101.com/r/n26OSC/1

,(?!\d+])

But this still not working when comma is part of string ("five,six" in my example).

Thank you for your help.

Raskolnikov
  • 3,791
  • 9
  • 43
  • 88

0 Answers0