Validate text patterns using regular expressions or allowing only numerical input
Input | Expression | Validation | Input match | Example of validation message |
---|---|---|---|---|
IBAN | ^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$ | Checks for IBAN structure (no spaces, no lowercase letters, between 15 and 34 characters in total) | DE89370400440532013000 | The IBAN has an incorrect format |
German IBAN | ^DE\d{2}\d{8}\d{10}$ | Ensures the IBAN follows the structure for German accounts and is 22 characters long | DE89370400440532013000 | Ensure this is a German IBAN |
Supplier identifier | ^[A-Z]{2}\d{6}$ | Ensures that the identifier follows the pattern of 2 uppercase letters followed by exactly 6 digits | NL336789 | This is not a correct identifier |
Postcode | ^\d{5}$ | Checks for 5 digits | 85774 | Ensure the code has five digits |
Value greater than 0.00 | ^([1-9]\d*(\.\d{1,2})?|0\.[1-9]\d?)$ | Check whether the value is greater than 0.00 | 2.54 | Enter a value greater than 0.00 |
Positive value or 0 | ^(0|[1-9]\d*)(\.\d{1,2})?$ | Check whether a value is a positive number or 0. Allow decimals. | 0.12 | Enter a positive value or 0 |
Email addresses with a specific domain | ^[a-zA-Z0-9._%+-]+@mycompany\.com$ | Validates email addresses that end with “@mycompany.com” | magdalena@mycompany.com | |
Price format with a comma for decimal and dot for thousands | ^[1-9]\d{0,2}(\.\d{3})*(,\d{2})?$ | Validates European-style formatted numbers with optional thousands separators and exactly two decimal places | 1.234,56 or 1.234.567,89 | Enter the price separating thousands with a point |
(?=...)
, (?!...)
, (?<=...)
, or (?<!...)
are not supported. This refers to all positive and negative lookahead expressions and positive and negative lookbehind expressions.