Below is the string I am trying to split on comma.

If comma is present inside () or {}, that string shouldn't be splitted.

I am splitting using below code:

for now it's only taking care of (), how do i include {} as well?

```
import re
s = "Water,^.*f04.*&~(.*z.,*)$,Iron Oxides (CI 77491, 77492),a{3,4}"
print re.split(r',\s*(?![^()]*\))', s)

```

Output should be :

```
[Water,^.*f04.*&~(.*z.,*)$,Iron Oxides (CI 77491, 77492),a{3,4}]

```