title: Check if regex pattern is correct
body: <p>I just made a regex pattern for replace links to HTML anchor tags, this is it:</p>
  
  <pre><code>~((http\:\/\/|https\:\/\/)([^ ]+)) ~
  </code></pre>
  
  <p>The reason why I ask this, is because I just finished this regex recently and made a few tests with some links, it works great but I want to be sure that there is no bugs with this pattern (I'm a regex newie) and maybe a regex expert could tell his opinion and / or suggestion.</p>
  
  <p>By the way, if you're figuring out the space at the end, you may think it will not work if the string doesn't ends with a space, but my trick is to add that space to the string before the replacement and then remove it again once the stuff is done.</p>
  
  <p>PD:</p>
  
  <p>I don't take care of the link's validation itself, I just want to search for the strings that starts with http:// and ends with a space, nothing else, since link validation is a bit complicated.</p>
  
  <p>EDIT:</p>
  
  <p>Some of my code:</p>
  
  <pre><code>&lt;?php
  
      $patron = "~(https?:\/\/[^\s]+) ~";
      //$patron = "~((http\:\/\/|https\:\/\/)([^ ]+)) ~";
      $reemplazar = '&lt;a href="$1"&gt;$1&lt;/a&gt; ';
      $cadena = "https://www.youtube.com/watch?v=7it5wioGixA ";
  
      echo preg_replace($patron, $reemplazar, $cadena);
  
  ?&gt;
  </code></pre>