so is /^(?:$pattern)/ faster than just /^($pattern)/
Yes, it is. The normal parentheses capture the match inside into the variable $1 (or $2, $3, ...) and so they have to do extra work copying the characters. Both types of parentheses do grouping.
But my solution used first an alternation inside the regex and then second a logical or to combine the result of different regexes. The result is the same but the second method is faster.
-- Hofmator
| [reply] |