Simple string pattern matcher for Go
Go to file
tidwall 4c9fc61b49 Add MatchLimit function for limiting pattern complexity
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).
2021-10-08 07:36:13 -07:00
.github/workflows Create go.yml 2020-11-03 10:47:51 -07:00
LICENSE first commit 2016-08-30 07:19:45 -07:00
README.md Update README.md 2020-11-03 10:48:15 -07:00
go.mod Added go.mod 2020-12-23 04:57:38 -07:00
match.go Add MatchLimit function for limiting pattern complexity 2021-10-08 07:36:13 -07:00
match_test.go Add MatchLimit function for limiting pattern complexity 2021-10-08 07:36:13 -07:00

README.md

Match

GoDoc

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.