Golang matching: Difference between revisions
From wikinotes
(Created page with " = Documentation = <blockquote> {| class="wikitable" |- | <code>path.Match</code> (glob match) || https://pkg.go.dev/path@go1.18.3#Match |- | <code>regexp</code> || https://pkg.go.dev/regexp |- |} </blockquote><!-- Documentation --> = Match (glob) = <blockquote> <syntaxhighlight lang="bash"> import "path" isTrue := path.Match("f*", "foo") // glob match </syntaxhighlight> </blockquote><!-- Match (glob) --> = Regexp = <blockquote> <syntaxhighlight lang="go"> import "re...") |
(No difference)
|
Revision as of 17:01, 18 June 2022
Documentation
path.Match
(glob match)https://pkg.go.dev/path@go1.18.3#Match regexp
https://pkg.go.dev/regexp
Match (glob)
import "path" isTrue := path.Match("f*", "foo") // glob match
Regexp
import "regexp" isTrue, err := regexp.Match("^[a-z]+$", "foobar") // match