match

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2018 License: MIT Imports: 1 Imported by: 106

README

Match

Build Status GoDoc

Match is a very simple pattern matcher where '*' matches on any number characters and '?' matches on any one character.

Installing

go get -u github.com/tidwall/match

Example

match.Match("hello", "*llo") 
match.Match("jello", "?ello") 
match.Match("hello", "h*o") 

Contact

Josh Baker @tidwall

License

Redcon source code is available under the MIT License.

Documentation

Overview

Match provides a simple pattern matcher with unicode support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allowable

func Allowable(pattern string) (min, max string)

Allowable parses the pattern and determines the minimum and maximum allowable values that the pattern can represent. When the max cannot be determined, 'true' will be returned for infinite.

func IsPattern added in v1.0.1

func IsPattern(str string) bool

IsPattern returns true if the string is a pattern.

func Match

func Match(str, pattern string) bool

pattern:

{ term }

term:

'*'         matches any sequence of non-Separator characters
'?'         matches any single non-Separator character
c           matches character c (c != '*', '?', '\\')
'\\' c      matches character c

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL