Python Regular Expression [\d+]
<p>I am working on regular expression python, I came across this problem.</p>

<p>A valid mobile number is a ten digit number starting with a 7,8 or 9.
my solution to this was :</p>

<pre><code>if len(x)==10 and re.search(r'^[7|8|9]+[\d+]$',x):
</code></pre>

<p>for which i was getting error. later I changed it to</p>

<pre><code>if len(x)==10 and re.search(r'^[7|8|9]+\d+$',x):
</code></pre>

<p>for which all test cases passed. I want to know what the difference between using and not using <code>[]</code> for <code>\d+</code> in regex ?</p>

<p>Thanks  </p>

<p><code>[\d+]</code> = one digit (<code>0-9</code>) or <code>+</code> character.</p>

<p><code>\d+</code> = one or more digits.</p>

python regex