| 1234567891011121314151617181920212223242526272829303132333435 |
- package executor
- import (
- "fmt"
- "regexp"
- "strings"
- schemepkg "git.buran.team/main/cep/scheme"
- )
- type NotMatchProcessor struct {
- expression *regexp.Regexp
- }
- func NewNotMatchProcessor(processorScheme schemepkg.Processor) (*NotMatchProcessor, error) {
- e, err := regexp.Compile(processorScheme.KindNotMatch.Expression)
- if err != nil {
- return nil, fmt.Errorf("can't create not-match processor: %w", err)
- }
- return &NotMatchProcessor{
- expression: e,
- }, nil
- }
- func (this *NotMatchProcessor) Process(buffer []byte) bool {
- lines := strings.Split(string(buffer), "\n")
- for _, line := range lines {
- if this.expression.Match([]byte(line)) {
- return false
- }
- }
- return true
- }
|