Re: RegEx (back referencing)
| From: | Danny Shepherd | Date: | Sat, 03 Aug 2002 17:26:22 +0000 |
| Subject: | Re: RegEx (back referencing) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110975@lists.php.net to get a copy of this message | ||
What does the input string contain?
What does the output look like?
It might be a problem with php4.0.4 (I'm using 4.2.2) - why such an old
version?
Danny.
----- Original Message -----
From: "Phil Ewington" <phil@n-igma.net>
To: "PHP General" <php-general@lists.php.net>
Sent: Saturday, August 03, 2002 6:23 PM
Subject: RE: [PHP] RegEx (back referencing)
> Danny,
>
> It still doesn't work, could this be a problem in 4.0.4pl1 ??
>
>
>
> > -----Original Message-----
> > From: Danny Shepherd [mailto:danny@kyboshed.com]
> > Sent: 03 August 2002 18:11
> > To: phil@n-igma.net; PHP-General
> > Subject: Re: [PHP] RegEx (back referencing)
> >
> >
> > If you're trying to get <script>Lots of javascript</script> to look like
> > <font color="maroon">Lots of javascript</font> then this will be a
> > start
> >
> > $string = eregi_replace('<(/?)(scr[^>]*)>', '<\\1font
> > color="maroon">',$string);
> >
> > This will produce - <font color="maroon">Lots of javascript</font
> > color="maroon"> - not perfect, but a start.
> >
> > Danny.
> >
> > ----- Original Message -----
> > From: "Phil Ewington" <phil@n-igma.net>
> > To: "Danny Shepherd" <danny@kyboshed.com>
> > Sent: Saturday, August 03, 2002 5:52 PM
> > Subject: RE: [PHP] RegEx (back referencing)
> >
> >
> > > \\1 outputs nothing at all wrapped in font tags and closing
> > tags \ wrapped
> > > in font tags :o(
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Danny Shepherd [mailto:danny@kyboshed.com]
> > > > Sent: 03 August 2002 17:47
> > > > To: phil@n-igma.net; PHP General
> > > > Subject: Re: [PHP] RegEx (back referencing)
> > > >
> > > >
> > > > try
> > > >
> > > > \\1
> > > >
> > > > ----- Original Message -----
> > > > From: "Phil Ewington" <phil@n-igma.net>
> > > > To: "PHP General" <php-general@lists.php.net>
> > > > Sent: Saturday, August 03, 2002 5:03 PM
> > > > Subject: [PHP] RegEx (back referencing)
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > I am am writing a function to color code and indent
> > JavaScript source
> > > > using
> > > > > regular expressions and cannot seem to get back referencing
working.
> > The
> > > > > pattern match is successful but the output is a single
unrecognised
> > > > > character (a square).
> > > > >
> > > > > $string = eregi_replace("<(/?)(scr[^>]*)>", "«font
> > > > color=maroon»\1«/font»",
> > > > > $string);
> > > > >
> > > > > This results in opening and closing <script></script> tags
> > > > being replaced
> > > > > with a square being wrapped in font tags. I have this
> > working in Cold
> > > > Fusion
> > > > > but cannot seem to convert my scripts to PHP. Can anyone help?
> > > > >
> > > > > TIA
> > > > >
> > > > > Phil Ewington.
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit:
> > > > > http://www.php.net/unsub.php
> > > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php
> > > >
> > >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>