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>It should probably be <code>"^[47]{2,}$"</code>.</p>

<p>I visit the <a href="https://docs.python.org/2/library/re.html#regular-expression-syntax" rel="nofollow">regular expression syntax</a> page quite often, because I find it hard to remember all of the little tricks for building regexes.</p>

python regex search