String pattern constraint ( pattern ).
More...
#include <constraints.hpp>
Public Member Functions | |
| template<anch::val::StringLike V> | |
| bool | check (const V &str, std::string &message) const |
Public Attributes | |
| std::shared_ptr< const anch::val::PatternMatcher > | matcher |
| std::string | source |
| anch::val::PatternSyntax | syntax = anch::val::PatternSyntax::ECMASCRIPT |
String pattern constraint ( pattern ).
With ECMAScript syntax ( anch::val::pattern ), the pattern is searched in the value (it is not anchored: use ^ and $ to match the whole value), as in JSON Schema. With XSD syntax ( anch::val::xsdPattern ), it matches the whole value.
| bool anch::val::Pattern::check | ( | const V & | str, |
| std::string & | message ) const |
Check value
| V | the value type |
| str | the value |
| message | the error message (set when value is invalid) |
true when value is valid | std::shared_ptr<const anch::val::PatternMatcher> anch::val::Pattern::matcher |
Pattern matcher
| std::string anch::val::Pattern::source |
| anch::val::PatternSyntax anch::val::Pattern::syntax = anch::val::PatternSyntax::ECMASCRIPT |
Pattern syntax