2009年5月4日星期一

[PerlChina] Re: metacharacters 的屏蔽

我去查资料,发现有两种方式:(1)就是quotemeta函数:Returns the value of EXPR with all
non-"word" characters backslashed. (That is, all characters not
matching /[A-Za-z_0-9]/ will be preceded by a backslash in the
returned string, regardless of any locale settings.) This is the
internal function implementing the \Q escape in double-quoted strings
(2) 就是,$query='c:\zhu\perl\'
m/\Q$query\E/。

On 5月5日, 上午9时27分, agentzh <agen...@gmail.com> wrote:
> 2009/5/4 mark <zhusheng...@163.com>
>
> > 有没有人知道,屏蔽元字符(即将元字符当作普通字符处理)。
>
> quotemeta?
>
> -agentzh
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

没有评论: