Re: The difference between ereg and preg?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/08/06, Chris <dmagick@xxxxxxxxx> wrote:

Dave M G wrote:
> PHP List,
>
> Recently I wrote a piece of code to scrape data from an HTML page.
>
> Part of that code deleted all the unwanted text from the very top of the
> page, where it says "<!DOCTYPE", all the way down to the first instance
> of a "<ul>" tag.

> Is there any reason why either ereg or preg would be more desirable over
> the other?
>


Ereg uses POSIX regular expressions which only work on textual data and
include locale functionalily. preg uses PCRE, which work on binary as well
as textual data and is a more sophisticated regex engine, incorporating
minimal matching, backreferences, inline options, lookahead/lookbehind
assertions, conditional expressions and so on.

They are often faster than the POSIX equivalents also.




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux