diff --git a/regexes.go b/regexes.go index 9ecf4b1..ddcf785 100644 --- a/regexes.go +++ b/regexes.go @@ -45,7 +45,7 @@ const ( ethAddressRegexString = `^0x[0-9a-fA-F]{40}$` ethAddressUpperRegexString = `^0x[0-9A-F]{40}$` ethAddressLowerRegexString = `^0x[0-9a-f]{40}$` - uRLEncodedRegexString = `(%[A-Fa-f0-9]{2})` + uRLEncodedRegexString = `^(?:[^%]|%[0-9A-Fa-f]{2})*$` hTMLEncodedRegexString = `&#[x]?([0-9a-fA-F]{2})|(>)|(<)|(")|(&)+[;]?` hTMLRegexString = `<[/]?([a-zA-Z]+).*?>` splitParamsRegexString = `'[^']*'|\S+` diff --git a/validator_test.go b/validator_test.go index db5bf73..5dcd00e 100644 --- a/validator_test.go +++ b/validator_test.go @@ -9537,6 +9537,9 @@ func TestURLEncodedValidation(t *testing.T) { {"a%b", false}, {"1%2", false}, {"%%a%%", false}, + {"hello", true}, + {"", true}, + {"+", true}, } validate := New()