Note:  CapturePoint Regular Expressions can be written in multiple ways to achieve the same results.

 

Regex String Result

\d

Matches any digit.

\D

Matches any character except a digit.

\s

Matches any whitespace character.

\S

Matches any character except a whitespace character.

\w

Matches any letter, digit, or underscore.

\W

Matches any character other than a letter, digit, or underscore.

.

Matches any character except for a line break.  This can also be used as a placeholder.

\b

Matches a space that follows before or after a word (Word Boundary)

\B

Matches when there is no space following a word (Word Boundary)

[A-Z]

Matches any Uppercase letter A-Z of any length.

[a-z]

Matches any lowercase letter a-z of any length.

[a-zA-Z]

Matches any Uppercase or lower case letter of any length.

[A-Z0-9]

Matches any Uppercase letter or any number of any length.

^

Matches the start of the string.

[^]

Matches anything that is not written in the square brackets.  For example if the square brackets had [^\s] then this will match anything other than whitespace.

|

Pipe symbol generally means ‘or’ as in boolean and or logic.  So, your code could say find 1 through 3 or 7 through 9 like this.  [1-3 | 7-9]

{1}

This will look for the preceding element the exact number of times as what is written inside the curly brackets  If it shows {1}, then it will grab 1 character.

{2,}

This will look for the preceding element at least 2 times.

{3,8}

This will look for the preceding element a minimum of 3 times and at most 8 times.

?

Matches previous elements zero or one times. This is considered lazy.

??

Matches previous elements zero or one times, but as few as possible.

*

Matches previous elements zero or more times to unlimited number of times.  As it is unlimited, it is considered greedy.

*?

Matches previous elements zero or more times, but as few as possible.

+

Matches previous element one or more times.

+?

Matches previous elements one or more times, but as few as possible.

[ ]

Matches anything that is written in the square brackets.

[ , ]

Matches anything that is written in the square brackets and then a comma inside is used as a separator for multiple elements.

[0-9]

Matches any number with any length of numbers 0-9.

\A

Matches the start of the string except it is unaffected by a multiline option.

\z

Matches the end of the input without exception.

\Z

Matches the end of the string or the point before the final \n at the end of the input.  This is unaffected by a multiline option.

\G

Matches the point that the previous match ended. Used to find contiguous matches.

\f

Form feed

\n

Newline

\r

Carriage Return

\t

Tab

[\b]

Matches a backspace.  It must be enclosed in these square brackets to have this meaning.

$

Matches the end of the string or the point before a final \n at the end of the input.

 

Was this article helpful to you?