aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parse/match.go
Commit message (Collapse)AuthorAgeFilesLines
* templates: add match functionRobin Jarry2023-03-081-0/+30
Add a match function that returns true if a string matches the provided regular expression. The compiled regular expressions are cached in a sync.Map to avoid repetitive compilations of the same expressions. Caveat: if the user mixes the arguments order, it may cause the cache to consume a lot of memory filled with garbage regular expression objects. Ideally, we would need to limit the size of this cache and/or use a LRU cache implementation. Maybe someday? Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>