[PerlChina] 大家好,小弟弟我碰到个问题,请大家帮忙给看看呀

haidong jia haidongj at gmail.com
Tue Jul 11 20:21:30 PDT 2006


试了一下,这个不成啊。




在06-7-11,潘建锋 <panjianfeng1979 at gmail.com> 写道:
>
> "(<books:(.+)>)"改成 "(<books:([^>]+)>", 应该就可以了
>
> 在06-7-11,haidong jia <haidongj at gmail.com> 写道:
> >
> > 功能:把文本中含有<books:xxxxx>的部分全部替换为空
> 遇到问题:当字符串为<books:xxxxx>开头并且以它结尾的时候把整个字符串都给替换了,现在求一正确的方法,多谢.
> 代码如下
> sub strip_books {
>   my $str = shift;
>   my %allowed = allbooks;
>
>   my $j = Jcode->new(\$str, 'utf-8');
>
>   $j->s("(<books:(.+)>)", exists $allowed{$2} ? '' : $1);
>
>   return $j->utf8;
> }
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
>
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20060712/09b6aecc/attachment.html 


More information about the China-pm mailing list