
The ordinary characters and predefined patterns that are described earlier in this topic help build regular expressions. The pattern that these functions use is a regular expression. Matches a character that adds whitespace.įor example, the pattern "A" & MultipleDigits will match the letter "A" followed by one or more digits. Matches zero, one, or more characters that add whitespace. Matches zero, one, or more characters that don't add whitespace. Matches a single character that doesn't add whitespace. Matches one or more characters that add whitespace (space, tab, or newline). Matches one or more characters that don't add whitespace (not space, tab, or newline). Matches an email address that contains an "at" symbol and a domain name that contains a dot a hyphen.

Matches a single digit ("0" through "9"). Use the string-concatenation operator & to combine your own text strings with members of the Match enum: Match enum Predefined patterns provide a simple way to match either one of a set of characters or a sequence of multiple characters. This table lists the special characters: Special characterįor example, you can match "Hello?" by using the pattern "Hello\?" with a backslash before the question mark. To use these characters, either prefix the character with a \ (backslash) to indicate that the character should be taken literally, or use one of the predefined patterns described later in this topic. In the pattern language, certain characters are reserved for special purposes. (See MatchOptions for ways to modify this behavior.) The string "hello!" doesn't match the pattern because of the exclamation point on the end and because the case is wrong for the letter "h". The simplest pattern is a sequence of ordinary characters to be matched exactly.įor example, when used with the IsMatch function, the string "Hello" matches the pattern "Hello" exactly. For example, "abc" & Digit & "\s+" is a valid pattern that matches the characters "a", "b", and "c", followed by a digit from 0 to 9, followed by at least one whitespace character. Regular-expression codes, such as "\d+\s+\d+" or "+".Ĭombine these elements by using the string-concatenation operator &.Predefined patterns, such as Letter, MultipleDigits, or Email.Ordinary characters, such as "abc" or "123".You describe the pattern in a text string as a combination of: The key to using these functions is in describing the pattern to match. If you're using MatchAll to split a text string, consider using the Split function, which is simpler to use and faster. MatchAll returns an empty table if no match is found that can be tested with the IsEmpty function. Match returns blank if no match is found that can be tested with the IsBlank function. IsMatch returns true if the text string matches the pattern or false if it doesn't. Use Complete, Contains, BeginsWith, or EndsWith as appropriate for your scenario. IsMatch matches the entire text string ( Complete MatchOption), while Match and MatchAll search for a match anywhere in the text string ( Contains MatchOption).Use IgnoreCase to perform case-insensitive matches. These functions perform a case-sensitive match.If no sub-matches are defined in the regular expression, this table will be present but empty. ) ) functions to work with an individual sub-match. Use the ForAll function or Last( FirstN(.

Generally, named sub-matches are easier to work with and are encouraged.

The table of named and unnamed sub-matches in the order in which they appear in the regular expression. Single-column table of Text (column Value) The first character of the string returns 1. The starting position of the match within the input text string. To avoid this warning, rename the sub-match. If a named sub-match has the same name as one of the predefined columns (below), the sub-match takes precedence, and a warning is generated. The record or records contain: ColumnĮach named sub-match will have its own column. Match returns a record of information for the first match found, and MatchAll returns a table of records for every match found. You can also extract sub-matches to parse complex strings. Use Match to extract the first text string that matches a pattern and MatchAll to extract all text strings that match. If the entry doesn't match your criteria, add other controls that prompt the user to correct the entry. For example, you can confirm whether the user has entered a valid email address before the result is saved to your data source.

Use IsMatch to validate what a user has typed in a Text input control. The Match and MatchAll functions return what was matched, including sub-matches. The IsMatch function tests whether a text string matches a pattern that can comprise ordinary characters, predefined patterns, or a regular expression. Tests for a match or extracts portions of a text string based on a pattern.
