Next: REPEAT, REPT Up: A. Function Reference Previous: RECEIVED   Contents   Index

REGEX

Syntax: REGEX(S1, S2)

S1 = a string value
S2 = a string value

REGEX returns True (1) if the string S2 matches the pattern specified by the regular expression in string S1, and False (0) otherwise. This function is similar to EXACT except it allows ``wildcard'' comparisons by interpreting S1 as a regular expression of the type used in the Find and Extract operations.

In a regular expression, a character normally matches with the same character in the matching string. A few characters have special meanings:

. A period matches any character (e.g. A.C matches ``ABC'' or ``AXC''). Matches only at the beginning of a field (e.g. `^`ABC matches ``ABC'' but not ``AABC''). Matches only at the end of a field (e.g. ABC\$ matches ``AABC'' but not ``ABCD''). Matches any character between the character x and the character y (e.g. [0-5]\$ finds fields ending in the characters 0 through 5). Matches any character in the list xyz (e.g. [05]\$ finds fields ending in either a 0 or a 5). This form and the one above can be combined. [27-9]\$ will find fields ending with the characters 2, 7, 8, or 9.
These methods can be combined. Thus, the filter [brc]at finds ``bat,'' ``rat'' and ``cat.''

Examples:

REGEX(``t.p'', ``top'') = 1

REGEX(``t.*e'', ``table'') = 1

REGEX(``t.*e'', ``talk'') = 0

REGEX(``F[0-9]'', ``F3'') = 1

REGEX(``F[0-9'', ``F3'') = Error! Missing ]

REGEX(``a'', ``apple'') = 1

REGEX(``ab'', ``apple'') = 0

Excel function: N/A

Next: REPEAT, REPT Up: A. Function Reference Previous: RECEIVED   Contents   Index