正则表达式的什么味道是grep? [英] What flavour of regular expression is grep?
问题描述
我猜这不是一个Perl兼容正则表达式,因为有一种特殊的 grep
,特别是PCRE。什么是 grep
最相似?
I'm guessing it's not a Perl Compatible Regular Expression, since there's a special kind of grep
which is specifically PCRE. What's grep
most similar to?
有没有特别的怪癖 grep $我需要知道的c $ c> (我习惯于Perl和PHP中的
preg
函数)
Are there any special quirks of grep
that I need to know about? (I'm used to Perl and the preg
functions in PHP)
推荐答案
默认GNU grep
行为是在 POSIX基本正则表达式,同样修改了 POSIX扩展正则表达式 for egrep
(通常又称为 grep -E
)。 POSIX ERE是PHP的 ereg()
使用。
Default GNU grep
behavior is to use a slightly flavorful variant on POSIX basic regular expressions, with a similarly tweaked species of POSIX extended regular expressions for egrep
(usually aka grep -E
). POSIX ERE is what PHP ereg()
uses.
GNU grep
也宣称支持 grep -P
顺便说一下,PCRE。因此,不需要特别特殊的 grep
。
GNU grep
also claims to support grep -P
for PCRE, by the way. So no terribly special kind of grep
required.
这篇关于正则表达式的什么味道是grep?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!