title: amazon short url regex... why can't i get this to work
body: <p>here is a regex i got from: a blog i can't link to because i am new... just google amazon short url and click on the blog post by noah coad</p>
  
  <p>as you can see from this page... it is supposed to extract the unique product id from any amazon url so you can shorten it... or use it to pull info from amazon apis.</p>
  
  <p>here is the sample code i am trying to use to get it to work:</p>
  
  <pre><code>&lt;?php
  $example_url = 'http://www.amazon.com/dp/1430219483/?tag=codinghorror-20';    
  
  $reg = '(?:http://(?:www\.){0,1}amazon\.com(?:/.*){0,1}(?:/dp/|/gp/product/))(.*?)(?:/.*|$)';
  
  echo 'test&lt;br/&gt;';
  
  echo preg_match($reg,$example_url);
  ?&gt;
  </code></pre>
  
  <p>and here is my output:</p>
  
  <pre><code>test
  
  Warning: preg_match() [function.preg-match]: Unknown modifier '(' in /Users/apple/Sites/amazon/asin_extract.php on line 14
  </code></pre>
  
  <p>thanks so much! this is my first time posting on this site where i have found countless answers already</p>
  
  <p>on second hand... take back some of my thanks for this painful first time submission process... i had to trim this question since it thinks my regex patterns are urls</p>