Re: Parsing brackets in text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dotan Cohen wrote:
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.

Don't know if this is your problem but you need to escape the trailing ] as well:

preg_replace('/\[[a-z]\]/i', .....


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux