Re: [PHP] preg_match() returns false but no documentation why
- From: crayon.shin.chan.uk@xxxxxxxxx (Crayon Shin Chan)
- Date: Thu, 31 May 2007 13:31:32 +0800
On Thursday 31 May 2007 01:33, Jared Farrish wrote:
Can anybody spot why this doesn't seem to be working right? The manual
( http://us2.php.net/preg_match) says it returns "false" on error, but
preg_last_error() returns 0, which I assume points to the
"PREG_NO_ERROR" error code.
<code>
preg_match("^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$",$this->server)
</code>
I also tried ereg(), and have searched and gone through the comments.
Why would a regex operation return false?
If you check your error log you'll find:
Warning: preg_match(): No ending delimiter '^' found in xxx.php on line xx
IMO that shouldn't be a warning, it should be an error that halts
execution so people wouldn't go looking for a non-existant
preg_last_error() when preg_match() did not even run.
--
Crayon
.
- References:
- preg_match() returns false but no documentation why
- From: "Jared Farrish"
- preg_match() returns false but no documentation why
- Prev by Date: Re: [PHP] using mysql_escape_string with implode() !!
- Next by Date: Re: what does -> mean?
- Previous by thread: Re: [PHP] preg_match() returns false but no documentation why
- Next by thread: Re: Re: Re: preg_match() returns false but no documentation why
- Index(es):