Documentation ¶
Overview ¶
Package `wildcard` provides utils for working with a classic wildcard matching (only `?` and `*` are supported).
`Match` function is a golang's adaptation of Java's O(1) space solution:
https://www.programcreek.com/2014/06/leetcode-wildcard-matching-java/
and ~ 3.37 times faster then standard `filepath.Match`.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPattern ¶ added in v1.1.0
IsPattern - check if provided value is a wildcard pattern, i.e. it has special characters "*" or "?"
Example ¶
package main import ( "fmt" "github.com/iamolegga/wildcard" ) func main() { fmt.Println(wildcard.IsPattern("f*")) fmt.Println(wildcard.IsPattern("b?r")) fmt.Println(wildcard.IsPattern("baz")) }
Output: true true false
func Match ¶
Match - check if provided value match wildcard pattern
Example ¶
package main import ( "fmt" "github.com/iamolegga/wildcard" ) func main() { fmt.Println(wildcard.Match("foo", "f*")) fmt.Println(wildcard.Match("bar", "b?r")) fmt.Println(wildcard.Match("baz", "az")) }
Output: true true false
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.