Resolved: Repeated patterns in regex

In this post, we will see how to resolve Repeated patterns in regex


I tried to explain the pattern below. The key-value pair parsing should succeed if the values are separated by a new line or a comma. But separators should not create empty values, like a comma at the beginning, at the end or two consecutive commas, etc. So that I could get only key-value pairs by just calling capture groups.
I tried something like below, but it matches only first and last ones, excluding the others in one line.
Any ideas to capture the repeating pairs?
Edit: The “key” and “value” have their own patterns and I have solved them already. I am struggling with repeating capture groups. Just to clarify.

Best Answer:

Adding a simple OR-Block to your regex seems to do the job for your provided example:
Also, I can suggest, It’s by far the best tool to use for regex debugging!

If you have better answer, please add a comment about this, thank you!