From 5f76266a2b3da50b4f46c130a1645a0cce30f8ce Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 16:16:24 -0600 Subject: [PATCH] Simpler URL regexp --- basis/validators/validators-tests.factor | 2 ++ basis/validators/validators.factor | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/validators/validators-tests.factor b/basis/validators/validators-tests.factor index bd24323f20..d4f3487d0b 100644 --- a/basis/validators/validators-tests.factor +++ b/basis/validators/validators-tests.factor @@ -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 diff --git a/basis/validators/validators.factor b/basis/validators/validators.factor index 0ddced63e8..7c41d3efdb 100644 --- a/basis/validators/validators.factor +++ b/basis/validators/validators.factor @@ -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 ;