title: Trying to parse URL using Regex [Javascript]
body: <p>I am having some trouble parsing one part of the following URL out:</p>
  
  <pre><code>http://port-80.********************************************.box.************.com/********/search/?sid=123875&amp;brands=DELL|KROCKS&amp;sort=popularity
  </code></pre>
  
  <p>I am trying to parse out the following: DELL|KROCKS.</p>
  
  <p>So far I have the following regex expression which works to a certain extent:</p>
  
  <pre><code>/brands=(.*)[\&amp;?]/
  </code></pre>
  
  <p>What the above does is if the &amp; character is after the brands, it will get the following: DELL|KROCKS. However, if the &amp; is not there, it will get the following: DELL|KROCKS&amp;sort=popularity.</p>
  
  <p>Is there any way I can fix this?</p>