Regular Expressions 101

Community Patterns

match commas between sets or members, but not inside members.

-2

Regular Expression
Python

r"
,(?![^\[\]]*(?:\([^[]]]*\])?\])|,(?![^\{\}]*(?:\([^\{\}]]*\})?\})|\{|\}
"
g

Description

matches only those commas that are between sets, or between members of a set. does not match commas that are inside members.

Submitted by Amrit Kohli - 8 years ago