News for hackers. Stuff that matters.
Re:Learn Regex The Hard Way by jacobolus on Saturday February 25, 2012 @04:31AM (#3632602)
Unfortunately, the actual syntax of regexps is far from ideal. As an example, it’s completely stupid that non-capturing groups must be written as (?:…) when they are by far the common case.

Larry Wall’s writings on this general topic are fairly convincing. http://www.perl.com/pub/2002/06/04/apo5.html?page=2

Re:Learn Regex The Hard Way by zedshaw on Saturday February 25, 2012 @09:57AM (#3633043)
I don't consider that a failing of regular expressions (which predate perl), but a failure of implementation. I've thought that instead of syntax it should be an API option that says "this is a matcher" vs. "this is a capture". Then the same regex works for both, it's just how you run it.
Re:Learn Regex The Hard Way by eurleif on Saturday February 25, 2012 @09:59PM (#3634644)
So would it not be possible to mix capturing and non-capturing groups in the same regex? That's useful to do if you have code that expects specific things to be captured at specific group indices, and you need to add grouping somewhere else in the regex without messing it up.