title: Regex for extracting exactly 10 digits from String
body: <p>I have multiple formats of strings from which I have to extract exactly 10 digit number.
  I have tried the following regexes for it. But it extracts the first 10 digits from the number instead of ignoring it.</p>
  
  <pre><code>([0-9]{10}|[0-9\s]{12})
  ([[:digit:]]{10})
  </code></pre>
  
  <p>These are the formats </p>
  
  <p><strong>Format 1</strong></p>
  
  <pre><code>KINDLY AUTH FOR FUNDS
  ACC 1469007967   (Number needs to be extracted)
  AMT R5 000
  DD 15/5
  FROM:006251
  </code></pre>
  
  <p><strong>Format 2</strong></p>
  
  <pre><code>KINDLY AUTH FOR FUNDS
  ACC 146900796723423  **(Want to ignore this number)**
  AMT R5 000
  AMT R30 000
  DD 15/5
  FROM:006251
  </code></pre>
  
  <p><strong>Format 3</strong></p>
  
  <pre><code>PLEASE AUTH FUNDS
  ACC NAME-PREMIER FISHING
  ACC NUMBER -1186 057 378  **(the number after - sign needs to be extracted)**
  CHQ NOS-7132 ,7133,7134
  AMOUNTS-27 000,6500,20 000
  THANKS
  FROM:190708
  </code></pre>
  
  <p><strong>Format 4</strong></p>
  
  <pre><code> PLEASE AUTHORISE FOR FUNDS ON AC
   **1162792833** CHQ:104-R8856.00 AND       (The number in ** needs to be extracted)
   CHQ:105-R2772.00
   REGARDS,
  </code></pre>