preg_replace bug?

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Locked
yufold
Forum Newbie
Posts: 2
Joined: Fri Apr 04, 2008 6:57 pm

preg_replace bug?

Post by yufold »

Code: Select all

<?
 
$txt = <<< endoftxt
<tr><td><div class="infobox-spacer"></div><ul><li><div>Level: 60</div></li><li><div>Requires level 60</div></li><li><div>Side: Both</div></li><li><div>Start: <a href="/?item=20644">Nightmare Engulfed Object</a></div></li><li><div>End: <a href="/?npc=11832">Keeper Remulos</a></div></li><li><div>Difficulty: <span class="r2">60</span><small> &nbsp;</small><span class="r3">63</span><small> &nbsp;</small><span class="r4">72</span></div></li></ul></td></tr><tr><th>Series</th></tr><tr><td><div class="infobox-spacer"></div><table class="series"><tr><th>1.</th><td><div><b>Shrouded in Nightmare</b></div></td></tr><tr><th>2.</th><td><div><a href="/?quest=8447">Waking Legends</a></div></td></tr></table></td></tr>
endoftxt;
 
  echo preg_replace("/(?<=href=\"[\/?]{2})\w{1,}[=][0-9]{1,}\">(([a-zA-Z]+\s*)+)/"  ,"xx", $txt);
$txt1 = 'dddsssf'; /// work
 
  echo preg_replace("/(?<=href=\"[\/?]{2}\w{1,})[=][0-9]{1,}\">(([a-zA-Z]+\s*)+)/"  ,"xx", $txt);
$txt1 = 'dddsssf'; /// not work, no show
 
 
 why? i just move ) .
 
?>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: preg_replace bug?

Post by John Cartwright »

Question? Problem? Explanation?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: preg_replace bug?

Post by John Cartwright »

Since you made another duplicate thread I'm going to close this one.
Locked