On 3 February 2017 at 10:00, Raphaël Proust <raphla...@gmail.com> wrote: > One thing that always bothers me with regexes is that the same syntax > (parens) is used for both overriding precedence (e.g., `(foo)*` to > specify that star operates on the sequence `foo`) and groups (to be > recalled with `\1`–`\9`). > > Anyone else is bothered by this?
In PCRE, `(foo)' is for capturing groups, whilst `(?:foo)' is purely for precedence. So the two are at least distinguished, even if the syntax is rather unfortunate. There's also `(?P<name>foo)', which makes the capture more explicit. Capturing groups are generally a mess anyway though, e.g. their behaviour under Kleene star. cls