Re: reg exp problems

From: Date: Sat, 01 Jun 2002 17:47:47 +0000
Subject: Re: reg exp problems
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-100249@lists.php.net to get a copy of this message
Hi, thanks for the suggestion, but the <base> tag doesn't have to have a closing tag, OR it appears many/all sites I've seen don't use the closing tag. Andrew ----- Original Message ----- From: "Jason Wong" <php-general@gremlins.com.hk> To: <php-general@lists.php.net> Sent: Saturday, June 01, 2002 6:02 PM Subject: Re: [PHP] reg exp problems > On Saturday 01 June 2002 23:56, Andrew Brampton wrote: > > Hi, > > I've never used a reg exp, but I was trying to do something simple, and I > > just can't seem to do it :) > > > > I have a varible $fdata which contains the contents of a webpage, and I > > want to strip out the <base> tag. > > > > I try: > > $fdata = preg_replace("<base.*>","",$fdata); > > > > But its stripping out everything between the first "<base" and the last ">" > > on that line, instead of the of the ">" at the end of the base tag > > Try: (it should remove <base> & </base>) > > preg_replace("/(<base>)|(<\/base>)/", "", $fdata); > > *** Untested, use at your own risk *** > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > When you make your mark in the world, watch out for guys with erasers. > -- The Wall Street Journal > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#100249) next »