Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce simple string matcher #2433

Merged
merged 1 commit into from
Jan 20, 2017
Merged

Commits on Jan 12, 2017

  1. Introduce simple regex-like matcher

    Provide match.Matcher and match.ExactMatcher using regular expressions for
    matching use-case only.
    
    The matchers compile a regular expression into a Matcher, which only provides
    the Match functionality. This gives us a chance to optimize/replace some common
    cases used for matching:
    - replace capture-groups by non-capturing groups
    - remove leading/trailing `.*` expressions (Match already searches for
      sub-string matching the regex)
    - replace simple literal searches with `==` and `strings.Contains` and
      `strings.startsWith`
    - replace regex for alternative literals (e.g. `DEBUG|INFO|ERROR`) with
      strings.Contains over set of literals
    - optimized empty-lines checks
    
    If input regular expression can not be matched to a simple case, regexp.Regexp
    will be used.
    
    The `ExactMatcher` will embedd `<regex>` into `^<regex>$` by default.
    
    Note: Matcher does currently not split simple cases. e.g. `abc.*def` or
    `abc.def` will still fallback to regexp.Regexp.
    urso committed Jan 12, 2017
    Configuration menu
    Copy the full SHA
    c683077 View commit details
    Browse the repository at this point in the history