I’m attempting (and failing) to specify a single regex which I can use with PHP’s preg_match_all() for the following:
.foo { bar }
.baz, .bot { bip, bop }
I need to count all { and only , which are not between {}. Given the sample above, I should have exactly three matches. My difficulty (ignorance) is that I do not understand how to specify the “do not match commas between curly braces” part. My current regex matches all commas and opening curly braces:
({)*(,)*
Try this:
Meaning: