title: how to extract a phone number for a string using regular expression?
body: <p>If I have a string that contains the following: <strong>This is 1 test 123-456-7890</strong> <br>
  I need to extract <strong>1234567890</strong> as a phone number. I don't want to extract the number 1 that is before test. <br>
  How can I do that using regular expressions in java?</p>
  
  <p>I know a way but I am not sure if it is the best solution: </p>
  
  <pre><code>String inputString = "This is 1 test 123-456-7890";
  string result =  inputString.replaceAll("(\\d{3})-(\\d{3})-(\\d{4})",""); 
  String phoneNumber = inputString.replace(result, "");
  </code></pre>