modulepackage
0.0.0-20230128160543-ea87bdc34deb
Repository: https://github.com/webtor-io/stoplist.git
Documentation: pkg.go.dev
# README
stoplist
Generates stoplist from YAML-format
Supports:
- Regexp patterns
- AND/OR conditions
- References
Installation
go get 'github.com/webtor-io/stoplist'
Sample usage
package main
import (
"log"
"github.com/webtor-io/stoplist"
)
var rules = `
main:
- abra
- cadabra
`
func main() error {
r, err := stoplist.NewRuleFromYaml([]byte(rules))
if err != nil {
return err
}
res := r.Check("abra cadabra")
log.Println(res)
return nil
}
Rules
- YAML must have
main
key - it is starting point - Every key must have an array of rules and all these rules will be used with OR condition, like:
main:
- rule1
- rule2
- ...
- All keys can be referenced with curly brackets, like:
rule:
- something
main:
- {rule}
- Regular expression must be enclosed with slashes, like:
main:
- /\d+/
- OR condition is represented with pipe
|
, like:
main:
- aaa|bbb|ccc
- AND condition is represented with plus
+
, like:
main:
- aaa+bbb+ccc
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author