The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Regular Expressions


Below you find a short summary of available regular expression commands.

\ Backslash. In order to search for characters which are normally used in regular expressions one has to quote these characters by a preceding backslash.
^ Circumflex. A circumflex as the first character of the regular expression constrains matches to the beginning of lines. A circumflex as the first character of a set inverts the set. In any other case a circumflex is not allowed and has to be quoted by a preceding backslash in order to be searched for.
$ Dollar. A dollar sign as the last character of the regular expression constrains matches to the end of lines.
. Period. A period matches any single character.
[] Square brackets. A string enclosed in square brackets defines a set of characters which matches the string at the current position. If the first character of the string is a circumflex the set is inverted (this means that the regular expression matches any character except the characters in the set). In order to specify a range of characters, the first and the last characters of the range have to be connected by a hyphen (e.g. [0-9] defines a set of all digits).
Note that most of the special characters usually used as expression specifiers (i.e. $ . [ ( ) ? * and+ ) are treated as normal characters when used in a set definition. The only exceptions are the circumflex, the backslash, the hyphen and the closing bracket. These characters have to be quoted by a preceding backslash in order to be processed correctly.
? Question mark. An expression followed by a question mark matches zero or one occurrence of that expression.
* Asterisk. An expression followed by a asterisk matches zero or more occurrences of that expression.
+ Plus. An expression followed by a plus sign matches one or more occurrences of that expression.
\#xx Special character. ASCII code of an arbitrary character. xx is a two digit hexadecimal number representing the ASCII code of this character.
() Parentheses. Parentheses can be used to group characters together prior to using the repetition operators * + or ?. Parentheses must not be stacked.


Last Update: 2023-Feb-06