Re: [PHP] Parsing brackets in text

2006-11-14 Thread Shuping Zhou
Actually, preg_replace() can solve Dotan Cohen's problem. There was just a minor mistake in the code. Please try this: $title"; return $returnString; } $articleText="This is a very [long] and [stupid] string."; $articleText=preg_replace('/(\[[a-z]+\])/e', "makeLink('$1')", $articleText); pri

Re: [PHP] Parsing brackets in text

2006-11-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-11-13 15:02:53 +0200: > >http://cz.php.net/manual/en/reference.pcre.pattern.syntax.php > > > >Skip the Differences From Perl section. > > That I have read at least three or four times. I still don't capture > all of it, but I try. You are correct, I should have r

Re: [PHP] Parsing brackets in text

2006-11-13 Thread Dotan Cohen
On 13/11/06, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # [EMAIL PROTECTED] / 2006-11-13 01:35:44 +0200: > On 13/11/06, Chris <[EMAIL PROTECTED]> wrote: > > > > >function makeLink($matches) { > >$returnString="" . $matches[1] . ""; > >return $returnString; > >} > > > >$articleText

Re: [PHP] Parsing brackets in text

2006-11-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-11-13 01:35:44 +0200: > On 13/11/06, Chris <[EMAIL PROTECTED]> wrote: > > > > >function makeLink($matches) { > >$returnString="" . $matches[1] . ""; > >return $returnString; > >} > > > >$articleText="This is a very [long] string."; > >$articleText=preg_rep

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Dotan Cohen
On 13/11/06, Chris <[EMAIL PROTECTED]> wrote: " . $matches[1] . ""; return $returnString; } $articleText="This is a very [long] string."; $articleText=preg_replace_callback('/\[([a-z]+)\]/i' , "makeLink", $articleText); print $articleText . "\n"; ?> The callback takes whatever the reg

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Chris
Dotan Cohen wrote: On 13/11/06, Chris <[EMAIL PROTECTED]> wrote: Dotan Cohen wrote: > On 12/11/06, Chris <[EMAIL PROTECTED]> wrote: >> 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 fol

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Chris
Dotan Cohen wrote: On 12/11/06, Chris <[EMAIL PROTECTED]> wrote: 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' , makeLin

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Dotan Cohen
On 13/11/06, Chris <[EMAIL PROTECTED]> wrote: Dotan Cohen wrote: > On 12/11/06, Chris <[EMAIL PROTECTED]> wrote: >> 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 s

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Dotan Cohen
On 12/11/06, Chris <[EMAIL PROTECTED]> wrote: 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)

Re: [PHP] Parsing brackets in text

2006-11-12 Thread Chris
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

[PHP] Parsing brackets in text

2006-11-12 Thread Dotan Cohen
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 functio