|
|
|
|
|
- Escape characters
- Special characters
- Use a condition in a regular expression
- Wizard of the MatchRegularExpression function
MatchRegularExpression (Function) In french: VérifieExpressionRégulière
Warning
From version 27, this function is kept for backward compatibility. It is recommended to use RegexMatch, which uses the ECMAScript lexical grammar for regular expressions.
Checks whether a character string matches a specific format and retrieves the different substrings that match the format. A wizard in the code editor helps you create the format to be checked.
Syntax
Checking a format Hide the details
<Result> = MatchRegularExpression(<Element to check> , <Regular expression>)
<Result>: Boolean - True if the string matches the specified format,
- False if the string does not match the format.
<Element to check>: Character string Character string to check. This string must be written in Latin characters. <Regular expression>: Character string Reference format, expressed as a regular expression. This string must be written in Latin characters. This format uses the following characters: | | A B C - / _ | Letters and symbols to check. | [A-Z] or [0-9] | Interval of letters, digits or symbols to check. | * | 0 or more symbols to check. | + | 1 or more symbols to check. | \W | Checks for special characters (e.g., &, #, @, etc.). |
Remark: The | character defines an "OR" condition.
Checking a format and retrieving the elements that match the format Hide the details
<Result> = MatchRegularExpression(<Element to check> , <Regular expression> , <Variable 1> ... [, <Variable N>])
<Result>: Boolean - True if the string matches the specified format,
- False if the string does not match the format.
<Element to check>: Character string Character string to check. This string must be written in Latin characters. <Regular expression>: Character string Reference format expressed as a regular expression. This string must be written in Latin characters. This format uses the following characters: | | A B C - / _ | Letters and symbols to check. | [A-Z] or [0-9] | Interval of letters, digits or symbols to check. | * | 0 or more symbols to check. | + | 1 or more symbols to check. | \W | Checks for special characters (e.g., &, #, @, etc.). | ( ) | Groups part of an expression together. | { } | Defines the minimum and maximum number of times that the previous expression can occur (e.g., {min, max}). |
Remark: The | character defines an "OR" condition. <Variable 1>: Character string, Integer, etc. Variable that will be automatically initialized with the value that matches the first part of the <Format>. Each part is defined by the '(' and ')' characters. <Variable N>: Character string, Integer, etc. Variable that will be automatically initialized with the value that matches the Nth part of the <Format>. Each part is defined by the '(' and ')' characters.
Related Examples:
|
Unit examples (WINDEV): The regular expressions
[ + ] Using regular expressions with WINDEV. Two use modes are presented for the regular expressions: - checking the input format - checking out different elements while respecting the input format. This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
|
|
Unit examples (WINDEV Mobile): The regular expressions
[ + ] Using regular expressions with WINDEV Mobile. It presents 2 modes for using the regular expressions: - check the input format - check out the different elements that match the input format. This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
|
|
Unit examples (WINDEV): Advanced input mask
[ + ] Handling the input masks in WINDEV: - Defining the format of positive/negative number in a numeric edit control - Defining how negative numbers will be displayed in a numeric edit control - Defining how the value 0 will be displayed in a numeric edit control - Using a regular expression to prevent from typing characters other than 1, 2, 3, 4, 5 and 6. - Using a regular expression to "regulate" the input of a French registration number
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|