Let's say I have the data string (to make it easier: assuming only alphanumeric characters can occur as values, no quotation marks or empty slots):
[12365, blah, 458, hello, 99996332]
I have looked at Regex for Comma delimited list and best I could find was the regex
(.+?)(?:,|$)
... which results with 5 matches in group 1 in https://regex101.com/:
However, those also contain the string "delimiters", if you will - that is, the [
and the ]
- in the matches.
SO, I thought I'd add the [
and the ]
as a literal match, so I can avoid them interfering with the rest - I used the regex:
\[(.+?)(?:,|$)\]
... but this results with 0 matches.
So, what javascript regex can I use, to "ignore" start and end delimiters of a string, and otherwise capture/match all comma-separated entries inside the start and end delimiters of the string?