Connecting Tech Pros Worldwide Help | Site Map

ereg & preg_match

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 04:19 AM
pomho
Guest
 
Posts: n/a
Default ereg & preg_match

Hi all,

Even having read the PHP Manual, I can't understand the difference between
the ereg function and the preg_match...

Could anyone help ?

thx in advance,

--
pomho



  #2  
Old July 17th, 2005, 04:19 AM
Andy Hassall
Guest
 
Posts: n/a
Default Re: ereg & preg_match

On Sat, 20 Mar 2004 16:38:54 +0100, "pomho" <pomho@nospam.org> wrote:
[color=blue]
>Even having read the PHP Manual, I can't understand the difference between
>the ereg function and the preg_match...[/color]

ereg uses POSIX extended regular expressions - these are defined by a standard
Unix specification, but have some limitations in what they can do.

preg_match uses PCRE (Perl Compatible Regular Expressions), which use the more
powerful and typically faster Perl-style expressions; the basics are the same,
but there's more pattern match expressions available in PCRE which means you
can match more complex expressions that would be awkward or just not possible
with ereg.

Unless you have a good reason otherwise, preg_match is preferred.

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
  #3  
Old July 17th, 2005, 04:19 AM
pomho
Guest
 
Posts: n/a
Default Re: ereg & preg_match

> ereg uses POSIX extended regular expressions - these are defined by a
standard[color=blue]
> Unix specification, but have some limitations in what they can do.
>
> preg_match uses PCRE (Perl Compatible Regular Expressions), which use the[/color]
more[color=blue]
> powerful and typically faster Perl-style expressions; the basics are the[/color]
same,[color=blue]
> but there's more pattern match expressions available in PCRE which means[/color]
you[color=blue]
> can match more complex expressions that would be awkward or just not[/color]
possible[color=blue]
> with ereg.
>
> Unless you have a good reason otherwise, preg_match is preferred.
>
> --
> Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
> http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space[/color]

Thanks you for your quick answer !

--
pomho


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.