
August 8th, 2003, 05:13 PM
|
|
Contributing User
|
|
Join Date: Oct 2002
Location: Washington, DC
Posts: 317
Time spent in forums: 2 m 3 sec
Reputation Power: 7
|
|
PHP Code:
/*----------------------------------------
Sample String
----------------------------------------*/
$blob = 'This is a line of blob with a link ( [link=http://site.com]Some Link Name[/link] ) in it.';
/*----------------------------------------
Regex
----------------------------------------*/
$blob = preg_replace( '/\[link=(.*?)\](.*?)\[\/link\]/Uis', '<a href="$1" target="_blank">$2</a>', $blob );
EDIT:::
Forgot that VB removes escapes when using single quotes, use the preg below:
Code:
$blob = preg_replace( '/\[link=(.*?)\](.*?)\[\/link\]/Uis', '<a href="$1" target="_blank">$2</a>', $blob );
__________________
~ Joe Penn
We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?
Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.
|