Regular Expression

A Regular Expression is a sequence of characters that forms a search pattern. Regular Expressions are very similar across all programming languages.

Regular expressions enable you to not only match or validate text, but to also extract specific information for further processing.

Grouping constructs can be used in regular expressions to search for patterns (groups of characters) within an input string. It is even possible to extract subgroups (nested groups) from an input string.

Defining and capturing groups of characters are done by using parentheses ( ) together with specific quantifiers. Any pattern inside a pair of parentheses will be captured as a group as per the quantifiers being used. When multiple groups are defined, the results of the captured groups are in the order in which they are defined (in order of open parenthesis).

Properties

Action

The function will always return the index and the length of found matches.

First match only returns the information for the first match found.

All matches returns a list of all matches found.

Replace will use the 'Replace with' field to replace content matching the pattern.

Split will split the string at the matched pattern. The matched pattern is not returned.

If you are, for example, looking for a comma to split a string (1,2) by, then a list containing two rows is returned. The comma will not be returned.

Expression

The search pattern to apply to the text. See some examples

Input string

The string to apply the pattern to.

Options

A set of standard Regular Expression options to pick from. Here is a detailed description of these options.

Replace with

A string to replace matched content with.

Loop results

A flag to indicate if lists returned by the function should be looped or provided as a 'list object'.


Definition and Debug Values

The Definition variables that are available from the Regular Expression function include those Index and Value variables for any defined groups:

Output

When debugging a Regular Expression, the debug values will indicate the number of matches found and the specific details thereof, including the position in a string (Index) and the value of the capture.

Example

The screenshot below shows an extract of Debug Values for the following Regular Expression:

Expression: \w+ (\d+)

Input string: Jan 1987 May 1969 Aug 2011

Debug


Wikipedia: Regular Expressions

RegularExpressions.info

Regexlib.com

gskinner.com

RegexOne.com

Microsoft.com - Grouping Constructs