| 
    Wt
    4.0.0
    
   | 
 
A validator that checks user input against a regular expression. More...
#include <Wt/WRegExpValidator.h>

Public Member Functions | |
| WRegExpValidator () | |
| Sets a new regular expression validator.  | |
| WRegExpValidator (const WString &pattern) | |
| Sets a new regular expression validator that accepts input that matches the given regular expression.  More... | |
| WRegExpValidator (const std::regex &pattern) | |
| Sets a new regular expression validator that accepts input that matches the given regular expression.  More... | |
| ~WRegExpValidator () | |
| Destructor.  | |
| void | setRegExp (const WString &pattern) | 
| Sets the regular expression for valid input.  More... | |
| void | setRegExp (const std::regex &pattern) | 
| Sets the regular expression for valid input.  | |
| WString | regExpPattern () const | 
| Returns the regular expression for valid input.  More... | |
| std::regex | regExp () const | 
| Returns the regular expression for valid input. 1 Returns the perl regular expression.  | |
| virtual Result | validate (const WString &input) const override | 
| Validates the given input.  More... | |
| void | setNoMatchText (const WString &text) | 
| Sets the text to be shown if no match can be found.  More... | |
| void | setInvalidNoMatchText (const WString &text) | 
| Sets the message to display when the input does not match.  More... | |
| WString | invalidNoMatchText () const | 
| Returns the message displayed when the input does not match.  More... | |
| virtual std::string | javaScriptValidate () const override | 
| Creates a Javascript object that validates the input.  More... | |
  Public Member Functions inherited from Wt::WValidator | |
| WValidator (bool mandatory=false) | |
| Creates a new validator.  More... | |
| ~WValidator () | |
| Destructor.  More... | |
| void | setMandatory (bool how) | 
| Sets if input is mandatory.  More... | |
| bool | isMandatory () const | 
| Returns if input is mandatory.  | |
| void | setInvalidBlankText (const WString &text) | 
| Sets the message to display when a mandatory field is left blank.  More... | |
| WString | invalidBlankText () const | 
| Returns the message displayed when a mandatory field is left blank.  More... | |
| virtual WString | format () const | 
| Returns the validator format.  More... | |
| virtual std::string | inputFilter () const | 
| Returns a regular expression that filters input.  More... | |
Additional Inherited Members | |
  Public Types inherited from Wt::WValidator | |
| typedef ValidationState | State | 
| Typedef for enum Wt::ValidationState.  | |
A validator that checks user input against a regular expression.
This validator checks whether user input matches the given regular expression. It checks the complete input; prefix ^ and suffix $ are not needed.
The regex should be specified using ECMAScript syntax (http://en.cppreference.com/w/cpp/regex/ecmascript)
Usage example:
The strings used in this class can be translated by overriding the default values for the following localization keys:
| Wt::WRegExpValidator::WRegExpValidator | ( | const WString & | pattern | ) | 
Sets a new regular expression validator that accepts input that matches the given regular expression.
This constructs a validator that matches the regular expression expr. 
| Wt::WRegExpValidator::WRegExpValidator | ( | const std::regex & | pattern | ) | 
Sets a new regular expression validator that accepts input that matches the given regular expression.
This constructs a validator that matches the regular expression expr. 
| WString Wt::WRegExpValidator::invalidNoMatchText | ( | ) | const | 
Returns the message displayed when the input does not match.
      
  | 
  overridevirtual | 
Creates a Javascript object that validates the input.
The JavaScript expression should evaluate to an object which contains a validate(text) function, which returns an object that contains the following two fields:
message that indicates the problem if not valid.Returns an empty string if the validator does not provide a client-side validation implementationq.
Reimplemented from Wt::WValidator.
Reimplemented in Wt::WTimeValidator.
| WString Wt::WRegExpValidator::regExpPattern | ( | ) | const | 
Returns the regular expression for valid input.
Returns the perl regular expression.
| void Wt::WRegExpValidator::setInvalidNoMatchText | ( | const WString & | text | ) | 
Sets the message to display when the input does not match.
The default value is "Invalid input".
| void Wt::WRegExpValidator::setNoMatchText | ( | const WString & | text | ) | 
Sets the text to be shown if no match can be found.
Sets the text to be shown if no match can be found.
| void Wt::WRegExpValidator::setRegExp | ( | const WString & | pattern | ) | 
Sets the regular expression for valid input.
Sets the perl regular expression expr. 
      
  | 
  overridevirtual | 
Validates the given input.
The input is considered valid only when it is blank for a non-mandatory field, or matches the regular expression.
Reimplemented from Wt::WValidator.
Reimplemented in Wt::WTimeValidator.
 1.8.11