Re: [PHP] preg_match() returns false but no documentation why





On Wed, May 30, 2007 3:06 pm, Jared Farrish wrote:
On 5/30/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote:

preg_match("^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$",$this->server)

You are missing the start/end delimiters is your first problem...

Which ones? I've got the starter "^" and the closer "$", so what else
am I
missing?

Whatever character you want to use:

"|^ldap(s)?"//[a-zA-Z0-9-]*\\.[a-zA-Z.]{2,5}$|"
"%^ldap(s)?"//[a-zA-Z0-9-]*\\.[a-zA-Z.]{2,5}$%"
"#^ldap(s)?"//[a-zA-Z0-9-]*\\.[a-zA-Z.]{2,5}$#"


would a regex operation return false?

It would return false if your string doesn't match the expression.


The manual claims it will return a 0 signaling "0 matches found." And
then,
under "Return Values," it's says very quickly:

"*preg_match()* returns *FALSE* if an error occurred."

If it's not returning ANYTHING I'm assuming it's faulting, but the
calling
the error function returns 0 (kind've ironic, really...).

Use === to distinguish FALSE from 0, which are not the same.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: mail problem
    ... You don't need to know anything about "augusta ... There is a missing '>' character. ... <dummy, bill.thompson@goodyear.com>... ...
    (AIX-L)
  • Re: New Shows POLL - Bones & JUSTICE Premiering on 08/30
    ... Forcing in her possible romantic past with Angel seemed a bit ... the incompetent Denver lady DA we've been seeing so much of. ... some suit didn't make them make the incompetent character a white male. ... We were gnashing our teeth at missing it - Ernesto's predecessors started ...
    (rec.arts.tv)
  • Re: Writing Trauma
    ... as the first rush of ideas will take me, and need to back off and ... and more stuff to fix when I finally do admit that it's wrong. ... Missing a major plot turn or making a character do something out ...
    (rec.arts.sf.composition)
  • Re: New Shows POLL - Bones & JUSTICE Premiering on 08/30
    ... the incompetent Denver lady DA we've been seeing so much of. ... some suit didn't make them make the incompetent character a white male. ... I really really really disliked Bones being incredibly rude to the ... We were gnashing our teeth at missing it - Ernesto's predecessors started ...
    (rec.arts.tv)
  • Re: Pty is losing bytes
    ... > I've also seen more than one byte missing. ... If it's NTTY (and I'm pretty certain it is - the generic tty code looks ... I'd have expected the problems to be due to character expansion, ... buffer, which may actually cause things to fit a lot better than they ...
    (Linux-Kernel)