title: preg_match_all \r\n confusion
body: <p>I try to extract all not formatted urls from a bbcode text.
  Regex should match:</p>
  
  <pre><code>1. "^http://xyz.abc$"
  2. "(http://xyz.abc)"
  3. " http://xyz.abc "
  </code></pre>
  
  <p>but not formatted bbcode urls like [url]http://xyz.abc[/url]</p>
  
  <p>The final regex is</p>
  
  <pre><code>#(?:^|\s|\()((?:www\.|https?:(?:\/\/)).*?\..*?)(?:\s|\)|$)#i
  </code></pre>
  
  <p>While testing I had some trouble with this and found out the trouble comes from \r\n.
  Example:</p>
  
  <pre><code>$text = "http://www.url.com/xxx/yyy/1.html
  http://www.url.com/xxx/yyy/2.html
  http://www.url.com/xxx/yyy/3.html";
  //or with \n
  //$text = "http://www.url.com/xxx/yyy/1.html\nhttp://www.url.com/xxx/yyy/2.html\nhttp://www.url.com/xxx/yyy/3.html";
  
  preg_match_all('#(?:^|\s|\()((?:www\.|https?:(?:\/\/)).*?\..*?)(?:\s|\)|$)#i', $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
  </code></pre>
  
  <p>$matches contains the first and the last url.</p>
  
  <p>But With \r\n</p>
  
  <pre><code>$text = "http://www.url.com/xxx/yyy/1.html\r\nhttp://www.url.com/xxx/yyy/2.html\r\nhttp://www.url.com/xxx/yyy/3.html";
  </code></pre>
  
  <p>$matches contains all urls. Why doesn't it work with \n?</p>
  
  <p>You can verify this here <a href="http://www.functions-online.com/preg_match_all.html" rel="nofollow">http://www.functions-online.com/preg_match_all.html</a></p>