Parsing brackets in text
| From: | Dotan Cohen | Date: | Sun, 12 Nov 2006 21:33:13 +0000 |
| Subject: | Parsing brackets in text | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-244532@lists.php.net to get a copy of this message | ||
I need to replace text enclosed in brackets with links. How can I get
that text, though? I've tried numerous variations of the following,
with no success:
$articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText);
I cannot get the text between the brackets send to the makeLink
function. Could someone push me in the right direction? An example of
the text would be:
$articleText="Ajax is an acronym of Asynchronous [JavaScript] and [XML]";
Where I'd like the strings "JavaScript" and "XML" sent to the makeLink
function. Thanks in advance.
Dotan Cohen