Regex pattern within text
<p>I have a long string of data which looks like:</p>

<pre><code>dstgfsda12345.123gsrsvrvsdfcsd23456.234tsrsd
</code></pre>

<p>Notice that the '12345.123' pattern is the same. I want to split the string on it using python (so <code>s.split(&lt;regex&gt;)</code>).</p>

<p>What would be the appropriate regex?</p>

<pre><code>'[0-9]{5}.[0-9]{3}'
</code></pre>

<p>does not work; I presume it expects whitespace around it(?).</p>

<p>Just escape <code>.</code>, and you are done:</p>

<pre><code>\d{5}\.\d{3}
</code></pre>

<p>You can use Regex token <code>\d</code> as a shorthand for <code>[0-9]</code>.</p>

<p><strong>Example:</strong></p>

<pre><code>&gt;&gt;&gt; re.split(r'\d{5}\.\d{3}', 'dstgfsda12345.123gsrsvrvsdfcsd23456.234tsrsd')
['dstgfsda', 'gsrsvrvsdfcsd', 'tsrsd']
</code></pre>

python regex