note
haukex
<p>The regex is:</p>
<c>
(?:(?|(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))
</c>
<p>which contains no capturing groups, hence <c>$1</c> isn't populated. In my first bit of code, in the regex I added an extra set of parentheses, <c>/($RE{delimited}{-delim=>'"'})/</c>, so there is a capturing group there. That's the equivalent of:</p>
<c>
((?:(?|(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\"))))
</c>
<p>Alternatively, you can take the first regex above and just change the non-capturing group <c>(?:...)</c> that surrounds the entire expression into a capturing group:</p>
<c>
((?|(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))
</c>
<p>Or, since you said you wanted to capture the stuff between the quotes, change that non-capturing group into a capturing one:</p>
<c>
(?:(?|(?:\")([^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))
</c>
<p>Plus, there's a bunch of simplifications that could be made to the first regex above anyway (really just removing unnecessary groups):</p>
<c>
/ \" [^\\\"]* (?: \\. [^\\\"]* )* \" /x
</c>
<p>and just add capturing groups to that as needed.</p>
1229800
1229820