谢谢,我找到原因了。 将shell里的正则表达式移到perl 里应该注意特殊字符的处理, 通配符那些应该加两次转义,如下面的'[\*|_]*\b' 移到perl里后 应为'[\\*|_]*\\b'
On 2月23日, 下午5时16分, smallfish <[email protected]> wrote: > try qx > > 2009/2/23 CherryMM <[email protected]> > > > 我在linux终端用命令" grep -E '^[[:space:]]*[\*|_]*\b.*?=' ./test.cpp" 能输出匹配的信 > > 息, 但我把这个命令移到perl代码里就不匹配了,在perl里引用命令的代码:` grep -E '^[[:space:]]*[\*|_]* > > \b.*?=' ./test.cpp` > > 请问一下这是怎么回事,谢谢? > > > -- > > blog -http://hi.baidu.com/smallfish7788 --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。 要在此论坛发帖,请发电子邮件到 [email protected] 要退订此论坛,请发邮件至 [email protected] 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛 -~----------~----~----~----~------~----~------~--~---
