[PerlChina] China-pm Digest, Vol 10, Issue 11

xiyu lu phoeneer at gmail.com
Thu Feb 16 12:10:51 PST 2006


谢谢, 我的问题是对于一个字符串"RRWWXXWW", 根据取其中'X'的字符的位置,替换另一个字符串"11001010"中相应位置的字符为'X',
替换后的字符串变成"1100XX10",
不过我已经用split/join的方式将它转换然后比较了.我想知道在s/pattern/replacement中是否可以通过正则表达式简单实现?
还是只能通过这样转换的方式实现?

On 2/17/06, china-pm-request at pm.org <china-pm-request at pm.org> wrote:
>
> Send China-pm mailing list submissions to
>        china-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.pm.org/mailman/listinfo/china-pm
> or, via email, send a message with subject or body 'help' to
>        china-pm-request at pm.org
>
> You can reach the person managing the list at
>        china-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of China-pm digest..."
>
>
> Today's Topics:
>
>   1. Re:  China-pm Digest, Vol 10, Issue 9 (Qiang ( James )  Li)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 15 Feb 2006 20:53:14 -0500
> From: "Qiang \( James \)  Li" <shijialee at gmail.com>
> Subject: Re: [PerlChina] China-pm Digest, Vol 10, Issue 9
> To: <china-pm at pm.org>
> Message-ID: <002101c6329b$c0651ed0$3201a8c0 at cozy505>
> Content-Type: text/plain;       charset="UTF-8"
>
> ----- Original Message -----
> From: "xiyu lu" <phoeneer at gmail.com>
> To: <china-pm at pm.org>
> Sent: Tuesday, February 14, 2006 8:26 PM
> Subject: Re: [PerlChina] China-pm Digest, Vol 10, Issue 9
>
>
> > HI, all
> >        could I only substitute one part of  pattern in
> > s/pattern/replacement/  ?
> > just like I want to use "RRWWXXWW" as pattern to change the X bit of
> string
> > "00110000" to "0011xx00",
> >  thanks
>
> not sure what RRWWXXWW has to do with your example. but your example is a
> special case and you would have to treat it one by one. or, hopefully you
> could find out the common pattern in your string then do the substitution.
> maybe you can give a few examples so we can really help. oh, use Chinese
> if
> you can.
>
> btw, please don't quote the whole email while you reply. some of the
> content
> is useless and takes lots of space.
>
> Qiang
>
>
>
> ------------------------------
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
>
> End of China-pm Digest, Vol 10, Issue 11
> ****************************************
>
-------------- next part --------------
q?????!???,r??m??m???????j+??j)r?j??j?r????:?z??<?_???!???


More information about the China-pm mailing list