Regular Expressions 101

Community Patterns

Community Library Entry

-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 - 9 years ago