Re: The difference between ereg and preg?
| From: | Dave Goodchild | Date: | Fri, 04 Aug 2006 08:37:20 +0000 |
| Subject: | Re: The difference between ereg and preg? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240096@lists.php.net to get a copy of this message | ||
On 04/08/06, Chris <dmagick@gmail.com> 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