[PerlChina] perl 正则表达式
purl lamp
lamp.purl at gmail.com
Fri Jul 4 23:51:54 PDT 2008
anyway this command give me many hint about how perl run.
echo hello world | perl -land -e "print @F"
2008/7/5 张晓亮 <alaboszhang at gmail.com>:
> 奇怪了, 我的就通不过了. 环境跟你的一样.
>
> 我再试试.
>
>
>
>
> ----- Original Message -----
> *From:* fengpxu fengpxu <fengpxu at gmail.com>
> *To:* china-pm at pm.org
> *Sent:* Saturday, July 05, 2008 11:06 AM
> *Subject:* Re: [PerlChina] perl 正则表达式
>
> my $str = '/Book/LN/16.aspx古典仙侠';
>
> print $1,$2 if $str =~/\/Book\/LN\/(\d+).aspx(.*)/;
> print 'ok';
>
> 16古典仙侠ok
>
> windows xp sp2 perl 5.8.8 通过。
>
> 2008/7/5 张晓亮 <alaboszhang at gmail.com>:
>
>> 各位:
>>
>> 有类似如下字符串:
>> Book/LN/16.aspx古典仙侠
>>
>>
>> 用: print $1 if $str =~/\/Book\/LN\/(\d+).aspx/;
>>
>> 这样可以得到 16
>>
>>
>> 用:
>> print $1,$2 if $str =~/\/Book\/LN\/(\d+).aspx(.*)/;
>>
>> 这样不能得到 $2
>>
>> 请问这个正则该如何修改?
>>
>>
>>
>> aj
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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/20080705/c967df8f/attachment-0001.html>
More information about the China-pm
mailing list