Skip to content

Commit

Permalink
fix url_encoded regex (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn committed May 12, 2021
1 parent d07eb88 commit 95ac68b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion regexes.go
Expand Up @@ -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})|(&gt)|(&lt)|(&quot)|(&amp)+[;]?`
hTMLRegexString = `<[/]?([a-zA-Z]+).*?>`
splitParamsRegexString = `'[^']*'|\S+`
Expand Down
3 changes: 3 additions & 0 deletions validator_test.go
Expand Up @@ -9537,6 +9537,9 @@ func TestURLEncodedValidation(t *testing.T) {
{"a%b", false},
{"1%2", false},
{"%%a%%", false},
{"hello", true},
{"", true},
{"+", true},
}

validate := New()
Expand Down

0 comments on commit 95ac68b

Please sign in to comment.