title: Regex "match up to" (in two cases)
body: <p>I have the following regex expression which will capture the start of a quote tag and the author in various cases.</p>
  
  <p>I cannot get it to match up to <code>link=</code> OR <code>pid=</code> (note the space before each of those).</p>
  
  <p>At the moment, I think what is happening is the expression is matching indiviual letters, instead of the strings above.</p>
  
  <pre><code>\[(quote)\]?\s*(?:author)?=?(.[^link=|pid=]+[\w]*).*?\]
  </code></pre>
  
  <p>An example of the string I'm testing the regex on. I'm trying to capture two things: "quote" (which becomes my $1), and then the username (in various cases, which becomes my $2).</p>
  
  <p>The substitution is [$1=$2].</p>
  
  <p>I'm trying to stop the expression at a closing square bracket, so I don't have to deal with the quote tag contents, or the final close tag. The expression only deals with the opening quote tag and attributes.</p>
  
  <pre><code>[quote='User Name' pid='1082654' dateline='1411779439']Test[/quote]
  </code></pre>
  
  <p>With the regex expression above, it would match:</p>
  
  <pre><code>[quote='User Name' pid]Test[/quote]
  </code></pre>
  
  <p>When it should match everything above, except for the "pid". Here is a more complete example: <a href="http://regex101.com/r/iK2nO2/1" rel="nofollow">http://regex101.com/r/iK2nO2/1</a></p>
  
  <p>How can I more clearly define where the capture group should stop? I'm using this with PHP so I think the PCRE flavor.</p>