A validator that checks if a matches a regular expression pattern. More...
#include <seqan3/argument_parser/validators.hpp>
Public Types | |
using | option_value_type = std::string |
Type of values that are tested by validator. | |
Public Member Functions | |
std::string | get_help_page_message () const |
Returns a message that can be appended to the (positional) options help page info. | |
void | operator() (option_value_type const &cmp) const |
Tests whether cmp lies inside values. More... | |
template<std::ranges::forward_range range_type> | |
void | operator() (range_type const &v) const |
Tests whether every filename in list v matches the pattern. More... | |
regex_validator (std::string const &pattern_) | |
Constructing from a vector. More... | |
Related Functions | |
(Note that these are not member functions.) | |
Requirements for seqan3::validator | |
You can expect these (meta-)functions on all types that implement seqan3::validator. | |
void | operator() (option_value_type const &cmp) const |
Validates the value 'cmp' and throws a seqan3::validation_error on failure. More... | |
A validator that checks if a matches a regular expression pattern.
On construction, the validator must receive a pattern for a regular expression. The pattern variable will be used for constructing an std::regex and the validator will call std::regex_match on the command line argument. Note: A regex_match will only return true if the strings matches the pattern completely (in contrast to regex_search which also matches substrings).
The class than acts as a functor, that throws a seqan3::validation_error exception whenever string does not match the pattern.
|
inline |
Constructing from a vector.
[in] | pattern_ | The pattern to match. |
|
inline |
Tests whether cmp lies inside values.
[in] | cmp | The value to validate. |
seqan3::validation_error |
|
inline |
Tests whether every filename in list v matches the pattern.
range_type | The type of range to check; must model std::ranges::forward_range and the value type must be convertible to std::string. |
v | The input range to iterate over and check every element. |
seqan3::validation_error |
|
related |
Validates the value 'cmp' and throws a seqan3::validation_error on failure.
option_value_type | The type of the value to be validated. |
[in,out] | cmp | The value to be validated. |
seqan3::validation_error | if value 'cmp' does not pass validation. |