mirror of https://github.com/tidwall/match.git
4c9fc61b49
This commit adds the MatchLimit function, which it the same as Match but will limit the complexity of the input pattern. This is to avoid long running matches, specifically to avoid ReDos attacks from arbritary inputs. How it works: The underlying match routine is recursive and may call itself when it encounters a sandwiched wildcard pattern, such as: `user:*:name`. Everytime it calls itself a counter is incremented. The operation is stopped when counter > maxcomp*len(str). |
||
---|---|---|
.github/workflows | ||
LICENSE | ||
README.md | ||
go.mod | ||
match.go | ||
match_test.go |
README.md
Match
Match is a very simple pattern matcher where '*' matches on any number characters and '?' matches on any one character.
Installing
go get -u github.com/tidwall/match
Example
match.Match("hello", "*llo")
match.Match("jello", "?ello")
match.Match("hello", "h*o")
Contact
Josh Baker @tidwall
License
Redcon source code is available under the MIT License.