title: Ommitting a specific pattern from a regex statement
body: <p>I've spent the last couple of days trying to figure out how to resolve this particular issue and posting on SO, but no dice so far.  I think this is probably easier than I've been making it to be, but I need some help;</p>
  
  <p>Here is a pretty basic regex statement that linkifies pretty much any link.  It's not the only regex pattern I have, so I've included a piece that skips over the link if it includes the specific pattern "img.youtube.com/vi/"  It works great;</p>
  
  <pre><code>$message = preg_replace("#(((f|ht)tp(s)?://)?!(img.youtube.com/vi/)[-a-zA-Z?-??-?()0-9@:%_+.~\#?&amp;;//=,])+#i", "&lt;a href=$1 target='_blank'&gt;&lt;b&gt;$1&lt;/b&gt;&lt;/a&gt;", $message);
  </code></pre>
  
  <p>I do not want this to linkify any url with .jpeg, jpg, gif, or any popular image format, I have another expression that will embed those kinds of links (and it works fine, too).  So, I need to find a way to get this expression to reject those kinds of links.</p>
  
  <p>I've gotten advice on negative lookarounds, matching to specific strings, but none of them seem to work so far.  I need to find a way to get this regex to ignore any URL that ends with .jpeg and so forth;</p>
  
  <p>So, the regex statement above already has an example of a string that disqualifies certain URLs - ?!(img.youtube.com/vi/).  This seems like that's all I need to do, but where do I put it and how does it look?  The + symbol in the statement makes it so that the regex will scrutinize the string all the way to the end of it, using the matching characters of [-a-zA-Z?-??-?()0-9@:%_+.~#?&amp;;//=,].  So, this matching string should probably be put somewhere before the + symbol.  Does it go in "?!(img.youtube.com/vi/)"  ?  In my mind, it should probably look like this;</p>
  
  <pre><code>$message = preg_replace("#(((f|ht)tp(s)?://)?!(img.youtube.com/vi/|/^\.jpeg$/|/^\.jpg$/|/^\gif$/)[-a-zA-Z?-??-?()0-9@:%_+.~\#?&amp;;//=,])+#i", 
  "&lt;a href=$1 target='_blank'&gt;&lt;b&gt;$1&lt;/b&gt;&lt;/a&gt;", $message); 
  </code></pre>
  
  <p>Any help is appreciated.  </p>