Re: which regexp require preg_grep() and which can be used with ereg()?

From: Date: Sat, 06 Oct 2001 04:32:51 +0000
Subject: Re: which regexp require preg_grep() and which can be used with ereg()?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70196@lists.php.net to get a copy of this message
preg is Perl regex. ereg is POSIX. There are a *few* Perl features not implemented in preg I think the POSIX stuff is pretty complete... If you know the Perl regex, use preg_ If you know the POSIX regex, use ereg_ If you don't know either one (like me), try both in a test script, and use the one that works... I pretty much have to build up my regexes one element at a time in a test script, or I end up with a horrible mess that does nothing right... -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: John A. Grant <jazrant@zsc.nrcan.zc.ca> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Friday, October 05, 2001 5:17 PM Subject: which regexp require preg_grep() and which can be used with ereg()? > In Perl I used "/\S/" to check for blank lines read from a file. > Now I'm learning PHP. How do I know what is a 'standard' > regexp that ereg() can handle and how do I know what is > Perl-specific syntax so that I must use preg_grep() instead? > > For example, can I use ereg("\S",$buffer) to check for a blank > or must I use preg_grep()or that. What specific things require > preg_grep() to be used instead of ereg()? > > Thanks. > > -- > John A. Grant * I speak only for myself * (remove 'z' to reply) > Radiation Geophysics, Geological Survey of Canada, Ottawa > If you followup, please do NOT e-mail me a copy: I will read it here > > >

« previous php.general (#70196) next »