Home > Language Reference > Appendices

Regular expressions

The regular expressions accepted by the StringMatcher object and the "Find/Replace" dialog boxes must conform to the following syntax.

Characters

SyntaxSignification
xThe character x - with the exception of special characters * ? + - | () [ ]
\xThe character x

Atoms

SyntaxSignification
athe character a
[abc]the class formed by the characters a, b or c
[a-z]all the characters from a to z
[a-zA-Z]all the characters from a to z, or from A to Z
[^a]any character except a
[^a-z]any character except those between a and z (inclusive).
.any character except the line break or carriage return (equivalent to [^\n\r].

Note: using parentheses or the +, ?, *, or | operators is not allowed within a character class specification.

Cardinality

SyntaxSignification
X*zero or more occurence(s) of the letter X
X+one or more occurence(s) of the letter X
X?at least one occurence(s) of the letter X

Operators

SyntaxSignification
XYX followed by Y
X|YX or Y

Precedence rules

The operators below are listed in descending order of priority :

Using parentheses modifes these priorities.

Examples

ExampleCorresponding strings
foothe string "foo"
a|bca or b, followed by c (in other words "ac" or "bc")
a|(bc)the string "a" or the string "bc"
ab+the strings starting with a followed by one or more b's
(ab)+the strings "ab", "abab", "ababab", etc.
[a-z]+all words
[a\-z]+all successions of characters a, z, -
dim [a-z][a-z0-9_]* as +(new +)?timerall declarations of an object of type Timer.
[0-9]+( +)|[\t,;][tTfF]( +)|[\t,;][a-zA-Z]+\na numeric field, a boolean field, a non-empty text field then a line break, separated by spaces or a delimiter
[0-9]+a positive integer
[0-9][0-9]?/[0-9][0-9]?/(19)|(20)[0-9][0-9]a date
[\+\-]?[0-9]+(\.[0-9]*)?([eE][\+\-]?[0-9]+)?a number in scientific notation
[0-9a-z_]+(\.|-[0-9a-z_]+)*@[0-9a-z_]+(\.|-[0-9a-z_]+)+an email address