By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,826 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,826 IT Pros & Developers. It's quick & easy.

Searching for a pattern

P: n/a
Hello,

Has somebody a pattern which contains:
- URL Checking (This Syntax: http://www(with and without www).lol.com
- Only *.html, *.htm, *.php formats - also: http://www.lol.com/index.html or
index.htm or index.php.

Thanks.

Gretting!
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Carved in mystic runes upon the very living rock, the last words of Sven
Dzepina of comp.lang.php make plain:
Has somebody a pattern which contains:
- URL Checking (This Syntax: http://www(with and without www).lol.com
- Only *.html, *.htm, *.php formats - also:
http://www.lol.com/index.html or index.htm or index.php.


Do you mean something like this:

^http://(www\.)?[A-Za-z0-9-]+\.[A-Za-z0-9-]{2,}/?$

For full, proper URL validation, you'll have to go beyond a single
expression. I suppose it might theoretically possible to do it with just
a single expression, but I think people try to cram too much into
regexes, rather than breaking things down a bit.

It just so happens I recently wrote a URL validation plugin for Phorm.
You're welcome to extract the URLVal function from it and use it.

http://www.phorm.com/plugins.php3

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Jul 17 '05 #2

P: n/a
Hello Alan,

Your pattern can not help me. =(
Has somebody another idea?

Gretting.

"Alan Little" <al**@n-o-s-p-a-m-phorm.com> schrieb im Newsbeitrag
news:Xn**************************@216.196.97.132.. .
Carved in mystic runes upon the very living rock, the last words of Sven
Dzepina of comp.lang.php make plain:
Has somebody a pattern which contains:
- URL Checking (This Syntax: http://www(with and without www).lol.com
- Only *.html, *.htm, *.php formats - also:
http://www.lol.com/index.html or index.htm or index.php.


Do you mean something like this:

^http://(www\.)?[A-Za-z0-9-]+\.[A-Za-z0-9-]{2,}/?$

For full, proper URL validation, you'll have to go beyond a single
expression. I suppose it might theoretically possible to do it with just
a single expression, but I think people try to cram too much into
regexes, rather than breaking things down a bit.

It just so happens I recently wrote a URL validation plugin for Phorm.
You're welcome to extract the URLVal function from it and use it.

http://www.phorm.com/plugins.php3

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.