in reply to regex bottom line?
in thread Text::ParseWords regex doesn't work when text is too long?
The only method that supports arbitrary strings is the last one, as I demonstrated.
Doesdo the same thing as/[^'"\\]+|(?!\1)['"]/?/(?!\1)[^\\]/
No. But /[^'"\\]|(?!\1)['"]/ (note that I removed the "+") and /(?!\1)[^\\]/ are the same (provided \1 is either "'" or '"'). That is, they each match a single character that is not a backslash (\), nor the same as the quote character in \1.
Since the regex is matching zero or more occurrences of X or Y or Z, it also works to match zero or more occurrences of X or Y+ or Z.
Replacing Y with Y+ means we can grab tons of "uninteresting" characters quickly so that we don't have to loop through the surrounding (?: ... )* so many times (since we've seen that we are only allowed to loop through it 32k times).
- tye
|
|---|