AV1611 Posted March 10, 2006 Share Posted March 10, 2006 This statement came from lot of help online here...[code]$new_str = preg_replace('|\b([a-z\']+)\b|i', "<a href='../concordance.php?WORD=$1' target='reference'>$1</a>", $string);[/code]what it does is picks every work from a sting and turns the string into a clickable link.Now, I need to do something simular:I need to change every occurance of this string: [code]baptistrevival.com:8081/bible[/code]to this string:[code]www.baptistrevival.com[/code]Here is a real sample string:[code]$string='And the evening <sup><a href='http://baptistrevival.com:8081/bible/strong.php?data=H6153'>[H6153] </a> </sup> and the morning <sup><a href='http://baptistrevival.com:8081/bible/strong.php?data=H1242'>[H1242] </a> </sup> were <sup><a href='http://baptistrevival.com:8081/bible/strong.php?data=H1961'>[H1961]</a></sup> the fourth <sup><a href='http://baptistrevival.com:8081/bible/strong.php?data=H7243'>[H7243]</a> </sup> day. <sup><a href='http://baptistrevival.com:8081/bible/strong.php?data=H3117'>[H3117]</a> </sup> ';[/code] Link to comment https://forums.phpfreaks.com/topic/4574-preg_replace-help/ Share on other sites More sharing options...
AV1611 Posted March 10, 2006 Author Share Posted March 10, 2006 N/M:[code]$kill = "baptistrevival.com:8081/bible";$add = "www.baptistrevival.com";$string=str_replace($kill, $add, $string);[/code] Link to comment https://forums.phpfreaks.com/topic/4574-preg_replace-help/#findComment-16000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.