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
# [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
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
# [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
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
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
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
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
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)
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
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
11 matches
Mail list logo