title: What is the most correct regular expression for a UNIX file path?
body: <p>What is the most correct regular expression (regex) for a UNIX file path?</p>
  
  <p>For example, to detect something like this:</p>
  
  <pre><code>/usr/lib/libgccpp.so.1.0.2
  </code></pre>
  
  <p>It's pretty easy to make a regular expression that will match most files, but what's the best one, including one that can detect escaped whitespace sequences, and unusual characters you don't usually find in file paths on UNIX.</p>
  
  <p>Also, are there library functions in several different programming languages that provide a file path regex?</p>