Here is my code:
My goal is to give this url (id=) a value. Using the code above ill get the value "abc". Anytime I change "abc" to any int value it doesnt work. For example if I say $21 it will think I want to use the subpattern 21 instead of using subpattern 2 then add a single "1". I tried ascii in the replace without any luck...Code:$string = '<a href="a.php?id=">sometext</a>'; $result = (preg_replace('/(.+href=)"(.+\..+)"/i', '$1"$2abc"', $string) );
edit: well one way I csan bypass this problem in this scenario:
I am still looking for a real fix to this problem tho.Code:$result = (preg_replace('/(.+href=)"(.+\..+)="/i', '$1"$2=1"', $string) );


Reply With Quote
Bookmarks