title: How to search and add a string before the pattern in python using regular expressions
body: <p>Iam writing a program to find and replace a string from all the files with the given extension.<br>Here Iam using regular expressions for searching.The task is to findall the occurances and modify those.<br></p>
  
  <blockquote>
    <p>If my string is "The number is 1234567890"<br>
    Result after searching and replacing should be +911234567890</p>
  </blockquote>
  
  <p>I think i can re.sub() here like</p>
  
  <pre><code>s = "The number is 1234567890"
  re.sub(r"\d{10}",??,s)
  </code></pre>
  
  <p>What can be given as the second argument here i don't know what the number would be i have modify the same matched string by preceding it with +91
  <br>
  I could do it using the findall from re and replace from string like</p>
  
  <pre><code>s = "The number is 1234567890 and 2345678901"
  matches = re.findall(r'\d{10}',s)
  for match in matches:
      s = s.replace(match,"+91"+match)
  </code></pre>
  
  <blockquote>
    <p>After this s is The number is +911234567890 and +912345678901</p>
  </blockquote>
  
  <p>Is this the only way of doing it??Is it not possible using re.sub() ??
  If it is please help me.Thank you...!</p>