<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE>
<!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Verdana color=#0000ff size=2>Yes, what
I wanted was to use (?!...), (?=...) or (?<=...) and so on to
resolve this.</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>I believe the Power of perl regex
expression.</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>Thank you for the helping of
Havel Zhang and Wanliyou :-)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>Yang.liana</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>Aug/24/2006</FONT></DIV>
<DIV><FONT face=Verdana size=2>
<HR>
</FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发件人:</STRONG> Havel
Zhang</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发送时间:</STRONG>
2006-08-24 13:19:18</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>收件人:</STRONG>
china-pm@pm.org</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>抄送:</STRONG> </FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>主题:</STRONG> Re: [PerlChina] wanna
a regex expression</FONT></FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2>
<DIV>hi wanliyou:</DIV>
<DIV> don't set it as global, may ignore the last replacement.</DIV>
<DIV>yang wang to change '<FONT color=#0000ff>how are you today ? "are you ok?"
you are welcome!'</FONT>
<DIV><FONT face=Verdana color=#0000ff size=2> to
' how are hello today? "are you ok?" hello are welcome!'</FONT></DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffff" face=Verdana color=#000000
size=2>if you not using global, the last 'you' will be ignored.</FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2>Havel Zhang</FONT></DIV><BR><BR> </DIV>
<DIV><SPAN class=gmail_quote>On 8/24/06, <B class=gmail_sendername>卍刕卍</B>
<<A href="mailto:wanliyou@gmail.com">wanliyou@gmail.com</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>~s# # #g<BR><BR>~s# # #<BR><BR>Don't set it as global may help</DIV>
<DIV><SPAN class=e id=q_10d3dff1f180a958_1><BR><BR>
<DIV><SPAN class=gmail_quote>On 8/23/06, <B class=gmail_sendername>Havel
Zhang</B> <<A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:havel.zhang@gmail.com" target=_blank>havel.zhang@gmail.com
</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><FONT face="trebuchet ms">hi yang:</FONT></DIV>
<DIV><BR><FONT face="trebuchet ms"> you can using (?!...)
regex extension solve this problem. like
follows:<BR>#---------------------<BR>$a = 'how are you today ? "are you
ok?" you are welcome!';<BR>$a =~ s/you(?!\sok\?)/hello/ig; <BR>print $a
."\n";<BR>#-------------------</FONT></DIV>
<DIV><FONT face="trebuchet ms">Outputs:</FONT></DIV></DIV>
<DIV><SPAN>
<DIV><FONT face="trebuchet ms">how are hello today ? "are you ok?" hello are
welcome!</FONT></DIV></SPAN></DIV>
<DIV>
<DIV><FONT face="trebuchet ms">#-------------------</FONT></DIV>
<DIV><FONT face="trebuchet ms"></FONT> </DIV>
<DIV><FONT face="trebuchet ms"></FONT> </DIV>
<DIV><FONT face="trebuchet ms">other regEx extensions:</FONT></DIV>
<DIV><BR><FONT face="trebuchet ms">(?= ... ) if match ahead
successfully, return true. <BR>(?! ... ) if match ahead failed,
return true.<BR>(?<= ...) if match backwards successfully, return
true.</FONT></DIV>
<DIV><FONT face="trebuchet ms">(?<! ... ) if match backwards failed,
return true.<BR><BR>Good, luck. :)</FONT></DIV>
<DIV><FONT face="trebuchet ms"></FONT> </DIV>
<DIV><FONT face="trebuchet ms">Havel Zhang</FONT></DIV>
<DIV> </DIV>
<DIV></DIV>
<DIV><SPAN><SPAN class=gmail_quote>On 8/23/06, <B
class=gmail_sendername>杨晓亮</B> <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:yang.liana@gmail.com" target=_blank> yang.liana@gmail.com</A>
> wrote: </SPAN></SPAN></DIV>
<DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"></BLOCKQUOTE></DIV>
<DIV><SPAN>
<DIV>
<DIV>
<DIV><FONT face=Verdana><FONT size=2>
<DIV><FONT face=Verdana color=#0000ff size=2> Hi,
all!</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>
suppose a src string like this: how are you today ? "are you ok?" you are
welcome!</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2> I want
this string to be : how are hello
today? "are you ok?" hello are welcome!</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2>
</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2> 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?".</FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2> I
want to use the *Look ahead* or *Look behind* to solve it. can I
?</FONT></DIV>
<DIV><FONT face=Verdana color=#000000 size=2></FONT> </DIV>
<DIV>Yang.liana</DIV>
<DIV>Aug/23/2006</DIV></FONT></FONT></DIV></DIV></DIV><BR></SPAN></DIV>
<DIV>_______________________________________________<BR>China-pm mailing
list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:China-pm@pm.org" target=_blank>China-pm@pm.org</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://mail.pm.org/mailman/listinfo/china-pm"
target=_blank>http://mail.pm.org/mailman/listinfo/china-pm</A><BR> </DIV></DIV>
<DIV><SPAN><BR><BR clear=all><BR>-- <BR>真理使你自由
</SPAN></DIV><BR>_______________________________________________<BR>China-pm
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:China-pm@pm.org" target=_blank>China-pm@pm.org</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://mail.pm.org/mailman/listinfo/china-pm"
target=_blank>http://mail.pm.org/mailman/listinfo/china-pm</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR></SPAN></DIV>
<DIV>--==Best Regards From WanLi==--
</DIV><BR>_______________________________________________<BR>China-pm mailing
list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:China-pm@pm.org">China-pm@pm.org </A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://mail.pm.org/mailman/listinfo/china-pm"
target=_blank>http://mail.pm.org/mailman/listinfo/china-pm</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>真理使你自由 </FONT></DIV></BODY></HTML>