Haha, asking a PHP developer to part with his or her regular expressions is like asking them for their underpants :)
I guess if you're happy to just check HTTP-scheme URLs, then this might simplify things a little:
(^[http://]{1}([^[:space:]]*)[:alnum:]+[(\.){1}[:alnum:]]+$)
I prefer "alnum", ("alphanumeric"), presonally, to that "a-z0-9" jumble. I think it looks a little less cumbersome. Either way (yours or mine) this only checks as far as the domain, of course.
Maybe:
(^[http://]{1}([^[:space:]]*)[:alnum:]+[(\.){1}[:alnum:]]+(\/)[[:alnum]#?/&=]$)
Will allow for full URLs, including querystrings, internal anchors links,
etc. Haven't tried it, I must admit.
Replace [
http://] at the front with [[:alpha:]+://], and you'll be able to cope with
https://, ftp:// or telnet://
et cetera.
BTW, (and FWIW) Wrox is "back" the way MV Agusta is "back":
different design team from a different era, with different manufacturers, in a different factory, owned by different owners, from a different country, using different materials....
But, for all that, still painted red, still called "Wrox", and (I sincerely hope, in wishing them all the best) winning races again, soon, perhaps.
Quote:
quote:Originally posted by Kyle Ketterer
I've just completed this in RegExp format and I just wondering if it looks ok to you guys.::
ereg("^[http]{1}(://){1}[_a-z0-9-]+(\.){1}[a-z]+$");
I try to make it match a url with exactly one "http://" followed by one of more characters which is the followed by a dot (.) indicating the domain...then followed by x amount of characters for the domain. So, how is it looking?
Thanks
-kyle
|