<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><font face="trebuchet ms">how are hello today ? "are you ok?" hello are welcome!</font></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><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>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<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>_______________________________________________<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>真理使你自由