Re: Help with regular expressions

From: Date: Fri, 25 Jan 2002 01:14:29 +0000
Subject: Re: Help with regular expressions
Groups: php.general 
Request: Send a blank email to php-general+get-82031@lists.php.net to get a copy of this message
Sorry, I forgot the newline at the end... your reg ex should look like: //.*\n making your command be: ereg_replace("//.*\n","",$string) Try that ;) Jeff > I think your problem is you are not including whitespace. Also, remember > that . (dot) means any character except newline, so why not try this as your > reg ex: > > //.* > > Hope that helps. > > -Jeff > ----- Original Message ----- > From: "José Daniel Ramos Wey" <wey@one2one.com.br> > To: <php-general@lists.php.net> > Sent: Thursday, January 24, 2002 5:00 PM > Subject: [PHP] Help with regular expressions > > > > Hi! I´m new to regular expressions, and it seems to be an art to make it > > work as expected. > > > > I´m trying to remove all "single-line" comments from an string - that´s > > everything after "//" to the end of a line. I expected that this would do > > the job: ereg_replace("//[[:alnum:]]*\n","",$string), but it didn´t work. > > > > Any tips? > > > > TIA, > > Daniel Wey > >

« previous php.general (#82031) next »