Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

preg_replace help

Recommended Posts

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]


Share this post


Link to post
Share on other sites
N/M:
[code]
$kill = "baptistrevival.com:8081/bible";
$add = "www.baptistrevival.com";
$string=str_replace($kill, $add, $string);
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.