2009/2/17 cnhack TNT <cnhacktnt@gmail.com>:
> lookbehind 的匹配,要求为固定长度的模式,(?!=\s+) 中的 \s+ 是变长的,所以不符合要求
> 你可以指定几个空格,比如一个空格 (?!=\s)abc,或者两个空格 (?!=\s\s)abc ,依次类推
> 请参看 http://perldoc.perl.org/perlretut.html#Looking-ahead-and-looking-behind
>
> 2009/2/17 Michael Zeng <galaxy2004@gmail.com>
>>
>> 匹配前面不是空格的 abc
>>
>> my $str = " abc" ;
>> print "\a" if $str =~ /(?!=\s+)abc/ ;
>>
>> 怎么会匹配成功呢 ?
>>
>>
>> 另外:
>> print "\a" if $str =~ /(?<=\s+)abc/ ;
>>
>> 怎么出现编译错误: Variable length lookbehind not implemented in regex; marked by
>> <-- HERE in m/(?<=\s+)abc <-- HERE / at test_xiong.pl line 6.
>>
>>
>> --
>> Yours Sincerely
>> Zeng Hong
>> >>
>
--
-------------------------------
,,__
.. .. / o._)
/--'/--\ \-'|| riverlee(李江) Email:riverlee2008@gmail.com
/ perl \_/ / Harbin Medical University Bioinfomatics
.'\ \__\ __.'.' Msn:riverlee2008@live.cn
)\ | )\ | Blog:http://riverlee2008.blogspot.com
// \\ // \\
||_ \\|_ \\_
-' '--'' '--'
-------------------------------
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---
没有评论:
发表评论