Re: The difference between ereg and preg?

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

 



Dave M G wrote:
> Chris, Ligaya, Dave,
> 
> Thank you for responding. I understand the difference in principle
> between ereg and preg much better now.
> 
> Chris wrote:
>> ! in perl regular expressions means "not" so you need to escape it:
>> \!
> Still, when including that escape character, the following preg
> expression does not find any matching text:
> preg_replace("/<\!DOCTYPE(.*)<ul>/", "", $htmlPage);

does this one work?:

preg_replace('#^<\!DOCTYPE(.*)<ul[^>]*>#is', '', $htmlPage);

> 
> Whereas this ereg expression does find a match:
> ereg_replace("<!DOCTYPE(.*)<ul>", "", $htmlPage);
> 
> What do I need to do to make the preg expression succeed just as the
> ereg expression does?
> 
> Thank you for your time and advice.
> 
> -- 
> Dave M G
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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