fix url_encoded regex (#769)

pull/793/head
Dean Karn 4 years ago committed by GitHub
parent d07eb88fb0
commit 95ac68b6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      regexes.go
  2. 3
      validator_test.go

@ -45,7 +45,7 @@ const (
ethAddressRegexString = `^0x[0-9a-fA-F]{40}$` ethAddressRegexString = `^0x[0-9a-fA-F]{40}$`
ethAddressUpperRegexString = `^0x[0-9A-F]{40}$` ethAddressUpperRegexString = `^0x[0-9A-F]{40}$`
ethAddressLowerRegexString = `^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})|(&gt)|(&lt)|(&quot)|(&amp)+[;]?` hTMLEncodedRegexString = `&#[x]?([0-9a-fA-F]{2})|(&gt)|(&lt)|(&quot)|(&amp)+[;]?`
hTMLRegexString = `<[/]?([a-zA-Z]+).*?>` hTMLRegexString = `<[/]?([a-zA-Z]+).*?>`
splitParamsRegexString = `'[^']*'|\S+` splitParamsRegexString = `'[^']*'|\S+`

@ -9537,6 +9537,9 @@ func TestURLEncodedValidation(t *testing.T) {
{"a%b", false}, {"a%b", false},
{"1%2", false}, {"1%2", false},
{"%%a%%", false}, {"%%a%%", false},
{"hello", true},
{"", true},
{"+", true},
} }
validate := New() validate := New()

Loading…
Cancel
Save