title: Regex for external links: how to make an exception for my own link?
body: <p>I am using <code>regex</code> to change plain text to url if there is <code>http://</code> before the text. This works fine, but I don't want to make them a link if this link is <code>internal</code> (so a link that contains my websites name)... <strong>So I only want it to happen if it is an external link.</strong></p>
  
  <p>How can I do that? I tried adding a <code>!</code> before the http, but it did not work. Can someone help me out please? This is what I am using:</p>
  
  <pre><code>function wpse107488_urls_to_links( $string ) {
  
     $string = preg_replace( "/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2", $string );
  
      $string = preg_replace( "/([\w]+:\/\/[\w-?&amp;;%#~=\.\/\@]+[\w\/])/i", "&lt;a target=\"_blank\" title=\"" . __( 'Visit Site', 'your-textdomain' ) . "\" href=\"$1\"&gt;$1&lt;/a&gt;", $string);
  
      return $string;
  }
  </code></pre>
  
  <p><em>Edit: I am using a different function that makes a link from my internal links too (that is supposed to be so), but I think these two functions are blocking each other. That's why I gave a class to all my internal links. Can I exclude them using these classes?</em></p>