[PerlChina] wanna a regex expression
=?GB2312?B?hWSEXoVk?=
wanliyou at gmail.com
Wed Aug 23 19:25:08 PDT 2006
~s# # #g
~s# # #
Don't set it as global may help
On 8/23/06, Havel Zhang <havel.zhang at gmail.com> wrote:
>
> hi yang:
>
> you can using (?!...) regex extension solve this problem. like
> follows:
> #---------------------
> $a = 'how are you today ? "are you ok?" you are welcome!';
> $a =~ s/you(?!\sok\?)/hello/ig;
> print $a ."\n";
> #-------------------
> Outputs:
> how are hello today ? "are you ok?" hello are welcome!
> #-------------------
>
>
> other regEx extensions:
>
> (?= ... ) if match ahead successfully, return true.
> (?! ... ) if match ahead failed, return true.
> (?<= ...) if match backwards successfully, return true.
> (?<! ... ) if match backwards failed, return true.
>
> Good, luck. :)
>
> Havel Zhang
>
> On 8/23/06, 杨晓亮 < yang.liana at gmail.com> wrote:
>
> > Hi, all!
> suppose a src string like this: how are you today ? "are you ok?" you
> are welcome!
> I want this string to be : how are hello today? "are you ok?"
> hello are welcome!
>
> I want to use just a regex express to do it. but i cant prevent from
> "are you ok?" being changed to be "are hello ok?".
> I want to use the *Look ahead* or *Look behind* to solve it. can I ?
>
> Yang.liana
> Aug/23/2006
>
> _______________________________________________
> 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
>
--
--==Best Regards From WanLi==--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20060824/f73c1251/attachment.html
More information about the China-pm
mailing list