title: How to filter URLs that contain white space with preg match?
body: <p>I parse through a text that contains several links. Some of them contain white spaces but have a file ending. My current pattern is:</p>
  
  <pre><code>preg_match_all('#\bhttps?://[^\s()&lt;&gt;]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $links, $match);
  </code></pre>
  
  <p>This works the same way:</p>
  
  <pre><code>preg_match_all('/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/', $links, $match);
  </code></pre>
  
  <p>I don't know much about the patterns and didn't find a good tutorial that explains the meaning of all possible patterns and shows examples.</p>
  
  <p>How could I filter an URL like this:
  <a href="http://my-url.com/my%20doc.doc" rel="nofollow">http://my-url.com/my doc.doc</a> or even <a href="http://my-url.com/my%20doc%20with%20more%20white%20spaces.doc" rel="nofollow">http://my-url.com/my doc with more white spaces.doc</a></p>
  
  <p>The <code>\s</code> in that preg_match_all functions stands for a white space. But how could I check if there is a file ending behind one or some white spaces?</p>
  
  <p>Is it possible?</p>