PDA

View Full Version : Help with string replacement


amorya
Fri 18th Oct '02, 9:37am
I'd like to turn <a href="**">**</a> into {url=**}**{/url}

(Using the BBcode square brackets, but if I type those here it'd actually read it as a URL)

Anyone know how I would do that? For other tags I've been using something like this:

$mod=str_replace ('<b>','{b}',$mod);

Of course, I can't do that for a tag with something in the middle of it.

Please help!

Thanks,
Amorya

nsr81
Fri 18th Oct '02, 9:52am
some one will give you a good regular expression for it. However, seeing what you want, try the following:


$mod=str_replace ('<','{',$mod);
$mod=str_replace ('>','}',$mod);