Skip to main content

pattern_matches

Function pattern_matches 

Source
pub fn pattern_matches(pattern: &str, value: &str) -> Result<bool, String>
Expand description

Whether value matches a control’s pattern= — an ECMAScript regular expression matched against the WHOLE value (^(?:pattern)$), with the v flag a browser compiles it with: \d, \w and \s are ASCII digits, word characters and JavaScript’s whitespace, and a class may nest classes and combine them with -- and &&. A pattern that is not a valid expression constrains nothing, as in a browser. The v flag’s strings — \q{…} and the string properties (\p{RGI_Emoji}) — are refused by name: the engine here cannot express them.