An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/creachadair/pattern

Package pattern implements template-based string matching and substitution. A *pattern.P represents a template string containing a number of pattern words, named locations where substitution may occur. A pattern may be "matched" against a string to produce a set of bindings of names to substrings; or it may be "applied" to a set of bindings to produce a transformed string. A template is a string that contains zero or more pattern words. A pattern word has the general format That is, a single word (allowing letters, digits, "/", ":", "_", "-", "+", "=", and "#") enclosed in curly brackets, prefixed by a dollar sign ($). To include a literal dollar sign, double it ($$); all other characters are interpreted as written. Each pattern word is an anchor to a location in the template string. Binding regular expressions to the pattern words allows the the pattern to match strings. To match a pattern against a string, use the Match method. Match succeeds if the string is a full regexp match for the expansion of the template with the pattern word bindings. A successful match returns a list of Binds that give the text of the submatches. To find multiple matches of the pattern in the string, use the Search method. Search behaves like Match, but invokes a callback for each complete, non-overlapping match in sequence. String values may be substituted into a pattern using the Apply and ApplyFunc methods. Apply takes an ordered list of Bind values and interpolates them into the template; ApplyFunc invokes a callback to generate the strings to interpolate.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/creachadair/pattern
License: BSD-3-Clause
Latest release: almost 6 years ago
First release: almost 6 years ago
Namespace: github.com/creachadair
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 25 days ago

    Loading...
    Readme
    Loading...