python re.search quantifier
<p>I have this:-</p>

<pre><code>re.search("^[47]{2:}$", '447447')
</code></pre>

<p>... and was expecting it to return True.
But somehow it does not.</p>

<p>How come?
My understanding is that it was suppose to match any number which has any combination of 4 or 7, with at least 2 digits.
Is that correct?</p>

<p>The syntax is <code>{m,n}</code> where <em>n</em> could be omitted.</p>

<p>Fix:</p>

<pre><code>re.search("^[47]{2,}$", '447447')
</code></pre>

<p>See RegEx syntax: <a href="https://docs.python.org/3/library/re.html#regular-expression-syntax" rel="nofollow">https://docs.python.org/3/library/re.html#regular-expression-syntax</a></p>

python regex search