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

From: Date: Mon, 08 Oct 2001 02:30:32 +0000
Subject: Re: which regexp require preg_grep() and which can be used with ereg()?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-70314@lists.php.net to get a copy of this message
"Cc Zona" <cczona@nospam.invalid> wrote in message news:20011006180059.20769.qmail@pb1.pair.com... > In article <20011005222902.49675.qmail@pb1.pair.com>, > jazrant@zsc.nrcan.zc.ca (John A. Grant) wrote: > > > 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? > > The preg_* functions are faster and more powerful than ereg_*. So the main > reason to ever use an ereg is because one both unfamiliar with PCRE syntax > and uninterested in learning it. You already know Perl regex, so no > problem there: you do know PCRE (or will, with a five minute study of the > manual to learn the minor differences between Perl and PCRE syntax). > > If you feel like learning ereg syntax too, google for "POSIX regular > expressions", to numerous copies of the relevant man page (regex (6), > IIRC..?). You'll find it easy to learn! Yeah, I looked at the page(s). Incomprehensible and not very practical. What is the simplest way to check for a blank line (just spaces, tabs etc.) read from a file using ereg()? I couldn't find any equivalent for the Perl "/\S/". I must admit that contrary to your conclusion that I already know Perl regex, I'm a bit of a newbie at regex and the little I know came from the (excellent) Perl doc examples. -- 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 (#70314) next »