Simpler URL regexp
parent
565cd8913b
commit
5f76266a2b
|
@ -52,3 +52,5 @@ namespaces assocs ;
|
||||||
[ "4561_2612_1234_5467" v-credit-card ] must-fail
|
[ "4561_2612_1234_5467" v-credit-card ] must-fail
|
||||||
|
|
||||||
[ "4561-2621-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
|
||||||
|
|
|
@ -62,9 +62,7 @@ IN: validators
|
||||||
v-regexp ;
|
v-regexp ;
|
||||||
|
|
||||||
: v-url ( str -- str )
|
: v-url ( str -- str )
|
||||||
"URL"
|
"URL" R' (ftp|http|https)://\S+' v-regexp ;
|
||||||
R' (ftp|http|https)://(\w+:?\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?'
|
|
||||||
v-regexp ;
|
|
||||||
|
|
||||||
: v-captcha ( str -- str )
|
: v-captcha ( str -- str )
|
||||||
dup empty? [ "must remain blank" throw ] unless ;
|
dup empty? [ "must remain blank" throw ] unless ;
|
||||||
|
|
Loading…
Reference in New Issue