Skip to main content

matches_pattern

Function matches_pattern 

Source
pub fn matches_pattern(pattern: &str, text: &str) -> bool
Expand description

Apply a pattern rule to one value.

A pattern starting with shape: names a built-in structural check; <date-picker> and <time-picker> compile to inputs carrying one. Any other pattern is the literal-substring rule.

PatternShapeRanges
shape:dateYYYY-MM-DDmonth 01-12, day 01-31
shape:timeHH:MMhour 00-23, minute 00-59

Both are shape checks, not calendar checks: 2026-02-31 passes. Surrounding whitespace is trimmed first. An unknown shape: name never matches, so a typo fails loudly instead of silently accepting everything.