i want to search the define of macro of ZEND_BEGIN_ARG_INFO_EX
,
so i run the command
grep "define\s+ZEND_BEGIN_ARG_INFO_EX" -r ./
but it find nothing .
So,I try
grep "define\s*ZEND_BEGIN_ARG_INFO_EX" -r ./
it success return the define of ZEND_BEGIN_ARG_INFO_EX
,it return
./Zend/zend_API.h:#define ZEND_BEGIN_ARG_INFO_EX ....
My problem :
why \s+
do not match the space in macro ?
I think it should match at least one space .
The standard grep that comes with Linux does not accept
+
, only*
. You could put it like this:or this
There are two issues here:
\s
is PCRE syntax.grep
supports BRE (by default) or ERE (when called asegrep
or passed the-E
argument), but not PCRE absent nonstandard extensions. Use[[:space:]]
instead.+
is ERE syntax, whereas by defaultgrep
uses BRE. Either pass-E
to grep, or invoke it asegrep
, to enable ERE.Thus: