Re: which regexp require preg_grep() and which can be used with ereg()?
| From: | John A. Grant | Date: | Wed, 10 Oct 2001 13:31:51 +0000 |
| Subject: | Re: which regexp require preg_grep() and which can be used with ereg()? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70657@lists.php.net to get a copy of this message | ||
"Cc Zona" <cczona@nospam.invalid> wrote in message
news:20011008035754.27240.qmail@pb1.pair.com...
> In article <20011008024151.15354.qmail@pb1.pair.com>,
> jazrant@zsc.nrcan.zc.ca (John A. Grant) wrote:
>
> > 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 still don't understand why you would bother looking for an ereg
> equivalent when you can just use "/\S/" as-is with a preg_*, but
<shrug>...
I dunno. I guess I figured that I should learn the non-Perl
way, since I'm in the PHP world now. I always try to adapt
to a new language when I'm learning it, instead of holding
on to conventions and usage from other languages. But
I guess it's fine to use preg_*
[...]
> "[^[:space:]]"
Thanks. I hadn't seen that :space: thing before.
> Okay, since you find that easy to read, then by all means keep on
> familiarizing yourself with it. Like I said before, once you know Perl
> regex syntax it takes maybe 5 minutes to pickup the minor differences
> needed for PCRE.
Yes, I think I will use preg_* now. Thanks for the help.
--
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