RE: [PHP] regular expressions gods!
| From: | WILSON, Nick | Date: | Wed, 23 Aug 2000 04:56:01 +0000 |
| Subject: | RE: [PHP] regular expressions gods! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-13081@lists.php.net to get a copy of this message | ||
I think he was only looking to match .php files, so something more
like
for ($i=0; $i< $(your number of tags-1); $i++)
eregi_replace("(href=\")(.*\.php)", "href=\"text_\\2", $tags[$i]);
The \\2 is the second match, ie everything in the second lot of brackets.
Not tested.
> -----Original Message-----
> From: jeremy brand [mailto:jeremy@nirvani.net]
> Sent: Wednesday, 23 August 2000 14:09
> To: Justin French
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] regular expressions gods!
>
>
>
> for ($i=0; $i< $(your number of tags-1); $i++)
> eregi_replace('href="', 'href="text_', $tags[$i]);
>
> Maybe this will help, but I'm not exactly sure what you are asking.
>
> -jeremy brand
> ______________________________________________________________
> _________
> GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9
> _ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
> for more __
>
> On Wed, 23 Aug 2000, Justin French wrote:
>
> > Date: Wed, 23 Aug 2000 12:54:06 +1000
> > From: Justin French <justin@indent.com.au>
> > To: php-general@lists.php.net
> > Subject: [PHP] regular expressions gods!
> >
> > Okay,
> >
> > I have a series of strings, $TAGS[1], $TAGS[2]
> > thru to TAGS[????].
> >
> > I want to search these strings for any link to a
> > .php3 file within the current directory, with any
> > query string (or none). So it might be page.php3,
> > or page.php3?id=stuff, or whatever.
> >
> > in DOS syntax, <A HREF="*.php3*"
> >
> >
> > I then want to preceed the file name (eg page.php3)
> > with a $prefix string. In otherwords, if the prefix
> > is "text_", <A HREF="page.php3" will get turned into
> > <A HREF="text_page.php3"... if there is a query string,
> > or any other stuff in the <A> tag (like a TARGET=) it
> > should all stay intact.
> >
> >
> > Thanks heaps for any help / solutions posted :)
> >
> >
> > Justin French
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>