note 53233 deleted from function.preg-replace by didou
| From: | didou@php.net | Date: | Sun, 23 Apr 2006 22:50:30 +0000 |
| Subject: | note 53233 deleted from function.preg-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109226@lists.php.net to get a copy of this message | ||
Note Submitter: pietjeprik at gmail dot com
----
Just a little issue on which I broke my head on:
There's an option in any major bulletin board to place a link like this:
<?PHP
[url=http://www.thisismylink.com]The link[/url]
?>
It was explained here how you can use [url]www.url.com[/url] but it a little different:
<?php
$txt = preg_replace( "/\[url=(.*?)\](.*?)\[\/url\]/", "<a
href=\"\\1\">\\2</a>", $txt );
?>
if you wish to add another option so that the visitor can also use [url]www.url.com[/url], than just
add this below:
<?PHP
$txt = preg_replace( "/\[url\](.*?)\[\/url\]/", "<a
href=\"\\1\">\\1</a>", $txt );
?>