Sinan Ünür
Sinan Ünür

Reputation: 118166

When were non-capturing parentheses added to Perl's regular expressions?

I am having a hard time figuring out the earliest version of perl where non-capturing parentheses are supported in regex patterns?

Can I take this feature for granted for all versions of Perl5?

Upvotes: 7

Views: 2577

Answers (2)

cjm
cjm

Reputation: 62109

I dug out Perl 5.000 from my archive CDs. It includes

=item (?:regexp)
This groups things like "()" but doesn't make backrefences like "()" does.

So it's in all versions of Perl 5. (It's definitely not in Perl 4 or earlier.)

Upvotes: 15

eclark
eclark

Reputation: 166

Some time before 5.003_07 according to perlre for that version.

Upvotes: 6

Related Questions