Page 1 of 1
regex html parsing
Posted: Wed May 23, 2007 3:42 pm
by excultus
hello i need to use this
<div id=res>(.*?)</div>
in eregi() but it gives me REG_BADRPT, could somebody help me please?
it should return the contents of the tag
thanks much

Posted: Thu May 24, 2007 7:22 am
by feyd
Don't use ereg*.. use preg_match(_all)
Re: regex html parsing
Posted: Fri May 25, 2007 5:06 pm
by GeertDD
excultus wrote:hello i need to use this
<div id=res>(.*?)</div>
in eregi() but it gives me REG_BADRPT, could somebody help me please?
it should return the contents of the tag
thanks much

You could try escaping the star and/or the question mark like below. The error goes away, but you still need to test it.
Code: Select all
var_dump(eregi('<div id=res>(.\*\?)</div>', '<div id=res>tag</div>'));
You really should go for the PCRE functions as feyd said!