Why and when to use extra perl options in R

Out of curiosity, I have a general question about optional parameter perl

in functions R

like grep

. As the title suggests, I would like to know why and when to use this parameter. Should this be done at all, if possible?

In addition to this, I thought about the reason for this parameter. Someone must have figured out this is the way to go and I'm wondering why.

I'm pretty sure some of you know the answer.

+2


source to share


1 answer


Regular expressions come in a variety of flavors. Different tastes have different features, syntax supported, or other obscure differences.

Perl is considered one of the most functional flavors, which led to the development of PCRE (Perl-Compatible Regular Expressions), which allows the Perl flavor to be used in other languages. There are some other regex libraries that support Perl syntax to some extent.



Contrast this with the default regex flavor used in R: POSIX ERE, which is one of the least functional.

You can use this site to compare flavors.

+3


source







All Articles