title: php preg_replace phone numbers
body: <p>I want to replace the given phone numbers in an html string, such as</p>
  
  <pre><code>&lt;a&gt;click here now! (123) -456-789&lt;/a&gt;
  </code></pre>
  
  <p>I think that the best way to approach it would be to find all the different circumstances where there looks like a phone number, such as:</p>
  
  <pre><code>$pattern = *any 3 numbers* *any characters up to 3 characters long* 
  $pattern .= *any 3 numbers* *any characters up to 3 characters long* 
  $pattern .= *any numbers up to 4 numbers long*
  
  // $pattern maybe something like [0-9]{3}\.?([0-9]{3})\.?([0-9]{4})
  
  $array = preg_match_all($pattern, $string);
  
  foreach($array)
  {
      // replace the string with the the new phone number
  }
  </code></pre>
  
  <p>Basically, how would the regex be?</p>