in reply to Re^2: Capturing parenthesis and grouping square brackets
in thread Capturing parenthesis and grouping square brackets
It is quite telling that you had to resort to split to find an example where the capturing feature of parantheses might lead to unexpected behavior. And how many programs that use split really utilize a regex rather than a simple record separator consisting of one or two characters?
What is obvious to people and what is not, is far from obvious. Yes, parantheses are used to group items that belong together in expressions, also to express desired precedence. Perl programmers also expect them to capture parts of matches when used in regexes. A Perl beginner will not have problems with that feature most of the time. And my guess is that the beginner will switch from using $3 to $4 rather that using (?:...) (or [...]).
So from my humble point of view, it is a non-issue. The over-riding principle should be that change involves costs and should be avoided unless the benefits significantly outweight these costs.
|Replies are listed 'Best First'.|
Re^4: Capturing parenthesis and grouping square brackets
by Eily (Parson) on Jun 18, 2013 at 11:24 UTC