Re:Advanced Regular Expression Tips and Techniques
by dspillett on Monday December 09, 2013 @06:27AM
(#6873821)
I'm getting "Panda Endpoint Protection has blocked access to this page, Reason:The page contains malware or exploits than could infect your PC." from my office machine - is/was there something there that I should inform the site owner about, or a false alarm that I should let Panda know about?
Re:Advanced Regular Expression Tips and Techniques
by pcmonk on Monday December 09, 2013 @12:51AM
(#6872990)
I think it's simply because capturing groups are much more common than non-capturing groups. Even though non-capturing is "simpler", it's less common, so we default to capturing and use the more verbose syntax for non-capturing.
Re:Advanced Regular Expression Tips and Techniques
by brudgers on Monday December 09, 2013 @10:39AM
(#6874747)
Consider it as a compiler flag - a regex without capture and backtracking can be represented mathematicly as a regular expression (I.e. it can be translated into a DFA). Once a regex starts capturing, its representation requires a stack or other memory structure. Or a regex might or might not be a regular expression, strictly speaking (which isn't done all that often).
Re:Advanced Regular Expression Tips and Techniques
by teddyh on Monday December 09, 2013 @09:56AM
(#6874530)
Historical reasons. The capturing syntax came first, and when syntax for non-capturing groups was wanted, an otherwise illegal character sequence (? was chosen.
For eg. Here is one way I would do the first example shown (using Perl this time):
Output: