Page tree

Skip to end of metadata
Go to start of metadata

A regular expression is a pattern that describes a set of strings. A regular expression is a sequence of any of the following items:

  • literal character
  • matching character
  • repetition clause
  • alternation clause
  • subpattern grouped with parenthesis

Regular expressions syntax

The following table lists the regular expression syntax with it's corresponding descriptions:

Syntax

Description

.

Matches any character; used as a wildcard when creating a search string.

***

Matches zero or more instances of the previous pattern item.

+

Matches one or more instances of the previous pattern item.

?

Matches zero or one instances of the previous pattern item.

( )

Groups subpattern; repetition and alternation operators apply to the entire preceding subpattern.

|

Allows for alternation of a pattern.

For example, to match Hello or hello in a string, the regular expression should read: Hello|hello.

[ ]

Delimits a set of characters; the range is specified as [x-y].

If the first character in the set is ^, there is a match only when the remaining characters in the set are not present.

^

Anchors the pattern to the beginning of the string; this character must be the first character in the set.

$

Anchors the pattern to the end of the string; this character must be the last character in the set.

  • No labels