为什么和何时在R中使用可选的perl参数?

时间:2022-09-28 11:34:39

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?

出于好奇,我对grep等函数中的可选perl参数有一个一般性问题。正如标题所说,我想知道为什么和什么时候应该使用这个选项。如果可能的话,这是一种普遍的做法吗?

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.

我几乎肯定你们中有人知道答案。

1 个解决方案

#1


3  

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.

Perl被认为是功能最完备的库之一,这导致了PCRE(与Perl兼容的正则表达式)库的开发,它允许在其他语言中使用Perl。还有一些其他的regex库在某种程度上支持Perl语法。

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

与R: POSIX ERE中使用的默认regex风格相比,它是最不完整的特性之一。

You can use this site to compare flavors.

你可以使用这个网站来比较口味。

#1


3  

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.

Perl被认为是功能最完备的库之一,这导致了PCRE(与Perl兼容的正则表达式)库的开发,它允许在其他语言中使用Perl。还有一些其他的regex库在某种程度上支持Perl语法。

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

与R: POSIX ERE中使用的默认regex风格相比,它是最不完整的特性之一。

You can use this site to compare flavors.

你可以使用这个网站来比较口味。