/strmatch

Golang String and Regex Matcher

Primary LanguageGoApache License 2.0Apache-2.0

Overview

strmatch is a Go package that aims to provide a simple means to match a string against a list of strings and/or Regular Expressions.

Example

import (
    "github.com/crooks/strmatch"
)

// Create a new matcher instance
m := NewMatcher()

// Add a string to match against
err := m.SAdd("foo")

// Test if "bar" generates a hit (will return False)
match := m.Match("bar")

// Add a Regular Expression
err := m.RAdd("^ba[a-z]")

// Test if "bar" generates a hit (will return True)
match = m.Match("bar")