title: Converting telephone numbers into "tel:" hyperlinks with regular expression replacement
body: <p>I have the following being extracted from a database:</p>
  
  <blockquote>
    <p>Switchboard:265-7404-6,Marketing Hotline: 265-7403, B'ce: 333-6848</p>
  </blockquote>
  
  <p>I want to convert it to something like this in PHP:</p>
  
  <p><img src="https://i.stack.imgur.com/FZKGj.png" alt="Expected formatting of data"></p>
  
  <p>In the event of extension as: <code>265-7404-6</code> it only parses: <code>265-7404</code></p>
  
  <pre><code>function printdir()
  {
     $mysqli = new mysqli(constant("host"),constant("username"),constant("password"), constant("database"));
  
     $storedProc = "SELECT * FROM `directory`;";
     $result = $mysqli-&gt;query($storedProc);
  
     if($mysqli-&gt;affected_rows&gt;0)
     {
         while( $row = $result-&gt;fetch_assoc()) {
            echo $row['telephone']; /*Formatting here*/
         }
     }
  }
  </code></pre>
  
  <p></p>