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

Struct MatchRegexp

modules/caddyhttp/matchers.go:1460–1477  ·  view source on GitHub ↗

MatchRegexp is an embedable type for matching using regular expressions. It adds placeholders to the request's replacer.

Source from the content-addressed store, hash-verified

1458// using regular expressions. It adds placeholders
1459// to the request's replacer.
1460type MatchRegexp struct {
1461 // A unique name for this regular expression. Optional,
1462 // but useful to prevent overwriting captures from other
1463 // regexp matchers.
1464 Name string `json:"name,omitempty"`
1465
1466 // The regular expression to evaluate, in RE2 syntax,
1467 // which is the same general syntax used by Go, Perl,
1468 // and Python. For details, see
1469 // [Go's regexp package](https://golang.org/pkg/regexp/).
1470 // Captures are accessible via placeholders. Unnamed
1471 // capture groups are exposed as their numeric, 1-based
1472 // index, while named capture groups are available by
1473 // the capture group name.
1474 Pattern string `json:"pattern"`
1475
1476 compiled *regexp.Regexp
1477}
1478
1479// Provision compiles the regular expression.
1480func (mre *MatchRegexp) Provision(caddy.Context) error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected