in reply to Re^6: about style: use possessive or atomic?
in thread about style: use possessive or atomic?

So I accessed today to the code.
It was a regular expression which tries to match (number1) with (measuring units1){optional}, and (number2 with units2){optional}.
The shortened for simplicity regex looks like that:
/^ (?: ' \s* )? ($positive_number){1}+ \s* (?: \( \s* ($stdev) \s* \) )? \s* ($units_1)? ( \s* ($positive_number) \s* (?: \( \s* ($stdev) \s* \) )? \s* ($units_2) )? (?: \s* ' )? $/x
For example: $units_1 = "A|B3"; $units_2 = "C|D-3"; Then regex should match:
20B3 20 B3 15 D-3 20A15C
but it shouldn't match 20C.
With new backtracking it matches 20C as (2, undef, undef, 0, undef, C) === ($1, $2, $3, $4, $5, $6)

Replies are listed 'Best First'.
Re^8: about style: use possessive or atomic?
by LanX (Saint) on Aug 17, 2015 at 19:28 UTC
    Well the question seems answered now, its a bug from 5.20 onwards.

    (?>...) still works like expected (and its better readable IMHO)

    Seems like someone thought there should be a (erroneous) warning and patched the code.

    The perldoc mentioning redundancy might have paved the way for accepting this patch too easily.

    I'm surprised there was no unit test that alarmed p5p.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!