Splitting strings in python using import re
<p>Why does this work:</p>

<pre><code>string = 'N{P}[ST]{P}'

&gt;&gt;&gt; import re
&gt;&gt;&gt; re.split(r"[\[\]]",  string)
&gt;&gt;&gt; ['N{P}', 'ST', '{P}']
</code></pre>

<p>But this don't?</p>

<pre><code>&gt;&gt;&gt; re.split(r"{\{\}}", string)
</code></pre>

<p><code>{</code> and <code>}</code> are meta-characters in regular expressions and should be escaped or put into a character class<br>
<code>{\{\}}</code> - means just escaped curly braces within unescaped </p>

python regex