This page is maintained for older versions of Rapise only. The latest documentation can be found at: https://rapisedoc.inflectra.com
Regular Expressions
 Regular Expressions

Purpose

A regular expression is a sequence of characters that describes how to construct a set of strings.  It is composed of character literals and special characters.  Each character literal represents one single character (such as "a", "b", "C", "1").  The special characters can represent a character, many characters, or a choice about how to select characters.

Special Characters:

 Char Description Examples ? Combines with whatever character/sub-expression precedes it to represent 0 or 1 occurrences of that character/sub-expression. a? describes the set: {"", "a"} * Combines with whatever character/sub-expression precedes it to represent  0 or more occurrences of that character/sub-expression. a* describes the set: {"", "a", "aa", "aaa", "aaaa", "aaaaa", "aaaaa", ...} + Combines with whatever character/sub-expression precedes it to represent 1 or more occurrences of that character/sub-expression. a+ describes the set: {"a", "aa", "aaa", "aaaa", "aaaaa", "aaaaa", ...} . Any arbitrary character. .* describes the set of all possible strings. | Denotes a choice between two strings ab|ba describes the set: {"ab", "ba"} () Denotes a sub-expression. (abc)?d describes the set: {"abcd" , "d"} [] Denotes one character chosen from all the characters with the brackets.  You can use a hyphen to denote a range. [abcde] describes the set: {"a", "b", "c", "d", "e"] [A-Z] describes the set of all one-character, alphabetic, capitalized, strings. {"A", "B", "C", ... , "Z"} {n,m} Quantifier expression.  Meaning: "Between n and m occurrences of whatever sub-expression or character precedes." (abc){1,2} describes the set: {"abc", "abcabc"} ^ The beginning of a string. ^a.* matches all strings that begin with an a. \$ The end of a string. .*a\$ matches all strings that end with an a. \ Precedes a special character to take away any special meaning. [\\\\$\-\+\*] represents the set: {"\", "\$", "-", "+", "*"]

A string and regular expression match if the string is an element of the set described by the regular expression.

Usage

In Rapise, you must prepend regular expressions with the string "regex:".  So the regular expression describing all strings would be: regex: .*

There are three uses for regular expressions in Rapise: (1) in Object Locators, (2) in action overriding code, (3) in Custom Libraries.