tr///cds

c: 补齐不匹配的
d: 删除不匹配的
s: squeeze : 压缩重复的

=~ tr///cds   因为也用了 =~ , 所以有时候归为正则表达式 的运算介绍,

但实际上不是 regex



2009/12/18 Qiang (James) <[email protected]>

> WENFENG LIU wrote:
> > 也就是说y和tr功能一样,只是相对于tr,y能够解释元字符。
> > 那么d代表什么呢?
>
> Perl 自带的文档里有详细的说明。
>
> 在命令行里运行 perldoc -f tr 和 perldoc perlop, 或者网页版的
> http://perldoc.perl.org/functions/tr.html
>
>
> Qiang
>
> >
> > ------------------------------------------------------------------------
> > Date: Fri, 18 Dec 2009 11:44:48 +0800
> > Subject: Re: [PerlChina] 正则表达式中 y/*//d 代表什么?
> > From: [email protected]
> > To: [email protected]
> >
> >
> >
> > 2009/12/18 Tiger Peng <[email protected]
> > <mailto:[email protected]>>
> >
> >     y/// = tr///
> >
> >     2009/12/17 WENFENG LIU <[email protected] <mailto:[email protected]>>:
> >      > 求助
> >      > 里面y代表什么, d代表什么?
> >      >
> >     tr函数能以一一对应的方式将搜索字符串中的字符替换成字符串中的相应字
> >     符。tr函数不能解释正则表达式中的元字符 这里可以用y来替换
>
> --
>
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>
>


-- 
           Yours Sincerely
                   Zeng Hong

--

您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。


回复