I need a regular expression that will match a comma that is NOT between either a '[' and ']' or '(' and ')' or '{' and '}'. Other grouping symbols do not matter. I have tried to figure it out but I cannot come up with anything that accomplishes this.
The regex is to be used with the PHP preg_split function to split a string on the matched commas.
An example string containing commas and grouping symbols:
<div>Hello<div>,@func[opt1,opt2],{,test},blahblah
The string should split up as follows:
1: '<div>Hello<div>'
2: '@func[opt1,opt2]'
3: '{,test}'
4: 'blahblah'
And I just thought of this, but at this point all grouping symbols are guaranteed to have matching symbols, incase that helps.
Any help would be GREATLY appriciated =)