Reputation: 584
Out of curiosity, I have a general question about the optional perl
parameter in R
funtions like grep
. As the title says in the title, i'd like to know why and when one should use this option. Is it a general thing to do if possible?
In addition to that I thought about the reason of such a parameter. Someone must have decided that this is a way to go and I wonder why.
I am almost positive that someone of you knows an answer.
Upvotes: 2
Views: 97
Reputation: 51360
Regular expressions come in multiple flavors. Different flavors have different features, supported syntax, or other obscure differences.
Perl is considered as one of the most feature-complete flavor, which led to the develomment of the PCRE (Perl-Compatible Regular Expressions) library, which allows the use of the Perl flavor in other languages. There are some other regex libraries which support Perl syntax to some extent.
Contrast this with the default regex flavor used in R: POSIX ERE, which is one of the least feature-complete.
You can use this site to compare flavors.
Upvotes: 3