MCPcopy
hub / github.com/sindresorhus/ow / matches

Method matches

source/predicates/string.ts:55–60  ·  view source on GitHub ↗

Test a string against a regular expression. @param regex - The regular expression to match the value with.

(regex: RegExp)

Source from the content-addressed store, hash-verified

53 @param regex - The regular expression to match the value with.
54 */
55 matches(regex: RegExp): this {
56 return this.addValidator({
57 message: (value, label) => `Expected ${label} to match \`${regex}\`, got \`${value}\``,
58 validator: value => regex.test(value),
59 });
60 }
61
62 /**
63 Test a string to start with a specific value.

Callers 1

string.tsFile · 0.80

Calls 1

addValidatorMethod · 0.80

Tested by

no test coverage detected