title: HTML code for audio using PCRE
body: <p>I have a function to use audio in an HTML file</p>
  
  <pre><code>function html_code_for_audio($audio_file_location)
  {
     $extension=strtolower(substr(strrchr($audio_file_location, '.')  ,1));
     $html_code=
      '&lt;audio controls&gt; '.
      '&lt;source src="'.$audio_file_location.'" type="audio/'.$extension.'" &gt;'.
      'Your navigator is not well equipped to display audio files&lt;/audio&gt;';
     return($html_code);
  }
  </code></pre>
  
  <p>and I wonder if this code snippet can be improved/shortened using PCRE functions ; something like :</p>
  
  <pre><code>$html_code=
  preg_replace('`(.+)\.(.+)`', 
  '&lt;audio controls&gt; '.
  '&lt;source src="$1.$2" type="audio/$2"&gt;'.
  'Your navigator is not well equipped to display audio files&lt;/audio&gt;'
  , $audio_file_location);
  </code></pre>
  
  <p>Is it possible ?</p>