Regular Expression Commands

Regular Expression (RegEx) commands can be carried out using the main tool bar or the buttons on the tool strip. This section describes what each function does and how it appears in a Regular Expression.

Alphanumeric character

Inserts a \w in the RegEx.

Matches a single alphanumeric character in the search data. Use anytime an alphabetic or numeric character would be appropriate.

Space Character

Inserts a \s in the RegEx.

Matches a single space in the search data. Use anytime you want to match a space.

Digit Character

Inserts a \d in the RegEx.

Matches a single numeric character in the search data. Use anytime searching for a number would be appropriate.

Beginning of Line

Inserts a ^ at the beginning of the RegEx.

Instructs the search to only match data if it appears at the beginning of a line, rather than anywhere in a line or the end of a line. For example, to match the word "hello" only if it appears at the beginning of a sentence, use ^hello.

End of Line

Inserts a $ at the end of the RegEx.

Instructs the search to only match data if it appears at the end of a line, rather than anywhere in a line or at the beginning of a line. For example, to match the word "final" only if it appears at the end of a sentence, use final$.

Beginning of Word

Inserts a \b at the beginning of a word.

Instructs the search to only match data if it appears at the beginning of the word, not in the middle or end of a word. For example, searching \bcan would match "can" and "Canada," but not "American."

End of Word

Inserts a \b at the end of a word boundary.

Instructs the search to only match data if it appears at the end of a word, not in the middle or end of a word. For example, searching can\b would match "can" and "American," but not "Canada."

Whole Word

Inserts a \b at the beginning and end of the word boundary.

Instructs the search to only match data if it is the entire word, not part of the word appearing at the beginning, middle, or end. For example, searching for \bto\b would only match data containing "to," not "towards" or "hereto."

Alternate Word

Inserts ( ) around the word. Separate each word within the ( ) with a |.

Allows a search to match two or more different words in the same place. For example, use (there|here) to indicate the search should search for either "there" or "here" in the search data.

Alternate Character

Inserts [ ] around the character.

Allows a search to match two or more different characters in the same place. For example, use happ[yi]ness to match both "happyness" and "happiness."

Optional

Inserts ? after an alternate word or character marker in the RegEx.

Allows a search to match data with or without the optional character. For example, use colo[u]?r to match both "color" and "colour."

Repeat Zero or More

Inserts * after an alternate word or character marker in the RegEx.

Specifies that a string of text can be repeated once or more. For example, use (the)* cat to match "the cat" and "cat" in a string of text.

Repeat Once or More

Inserts + after an alternate word or character marker in the RegEx.

Specifies that a string of text can be repeated once or more. For example, use (the)+ to match "the" and "the the" in a string of text.

Repeat Specific

Inserts ( ) and { } containing a minimum or maximum number.

Instructs the search to match a string of text that repeated a specified number of times. For example, use (the){3,8} to match "the" between three and eight times in a string of text. Or use (the){,4} to match "the" up to four times, or (the){2,} to match "the" at least two times.

Ignore Case

Allows the search to match text without being case sensitive. For example, use (?i)usa(?i) to match "usa" and "USA." Or use (?i)America to match "America" and "america."

Sample Expressions

The Regular Expression builder also contains three sample expressions to search for basic matches, including email addresses, phone numbers, and IP addresses. Inserting a sample expression will automatically insert the code for one of these options.


Return to Using RegEx