title: Correct way to match path inside a URL? (8)
body: <p>Derived from JavaScript, The Good Parts, is a regex for matching URLs.</p>
  
  <p><strong>pseudo code (each number represents a sub-expression)</strong></p>
  
  <pre><code>/^(1)(2)(3)(4)(5)(6)(7)$/
  </code></pre>
  
  <p>In the 5 spot is this regex with some other things.</p>
  
  <pre><code>[^?#]*
  </code></pre>
  
  <p>Pretty simple, It is just a not character class, to match everything except <code>?</code> or <code>#</code>, as these will later be used to match a query and a fragment identifier.</p>
  
  <p>However, I want to replace this with a character class that does not use not - <code>^</code></p>
  
  <p>The first thing I was not sure of was whether or not Unicode can be used in a path.  If it can't I was planning on using an ASCII character set.</p>
  
  <p><strong>Clarification:</strong>  I don't want to use negative look ahead as this emulates a not character set.</p>
  
  <p><strong>Reference:</strong>  Here is the complete regex broken up into different lines for each part.</p>
  
  <pre><code>/^
  (?:([a-zA-Z]+):)?
  (\/{0,3})
  ([a-zA-Z0-9.\-]+)
  (?::(\d+))?
  (?:\/([^#?]*))?
  (?:\?([^#]))?
  (?:#(.*))?
  $/
  </code></pre>