MCPcopy
hub / github.com/caddyserver/caddy / MatchRegexp

Struct MatchRegexp

modules/caddytls/matchers.go:157–174  ·  view source on GitHub ↗

MatchRegexp is an embeddable type for matching using regular expressions. It adds placeholders to the request's replacer. In fact, it is a copy of caddyhttp.MatchRegexp with a local replacer prefix and placeholders support in a regular expression pattern.

Source from the content-addressed store, hash-verified

155// caddyhttp.MatchRegexp with a local replacer prefix
156// and placeholders support in a regular expression pattern.
157type MatchRegexp struct {
158 // A unique name for this regular expression. Optional,
159 // but useful to prevent overwriting captures from other
160 // regexp matchers.
161 Name string `json:"name,omitempty"`
162
163 // The regular expression to evaluate, in RE2 syntax,
164 // which is the same general syntax used by Go, Perl,
165 // and Python. For details, see
166 // [Go's regexp package](https://golang.org/pkg/regexp/).
167 // Captures are accessible via placeholders. Unnamed
168 // capture groups are exposed as their numeric, 1-based
169 // index, while named capture groups are available by
170 // the capture group name.
171 Pattern string `json:"pattern"`
172
173 compiled *regexp.Regexp
174}
175
176// Provision compiles the regular expression which may include placeholders.
177func (mre *MatchRegexp) Provision(caddy.Context) error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected