Simpler URL regexp

db4
Slava Pestov 2008-11-18 16:16:24 -06:00
parent 565cd8913b
commit 5f76266a2b
2 changed files with 3 additions and 3 deletions

View File

@ -52,3 +52,5 @@ namespaces assocs ;
[ "4561_2612_1234_5467" v-credit-card ] must-fail
[ "4561-2621-1234-5467" v-credit-card ] must-fail
[ t ] [ "http://double.co.nz/w?v=foo" dup v-url = ] unit-test

View File

@ -62,9 +62,7 @@ IN: validators
v-regexp ;
: v-url ( str -- str )
"URL"
R' (ftp|http|https)://(\w+:?\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?'
v-regexp ;
"URL" R' (ftp|http|https)://\S+' v-regexp ;
: v-captcha ( str -- str )
dup empty? [ "must remain blank" throw ] unless ;