Note
rxregexp.cls file. This means you must use a ::requires statement to activate its functionality, as follows:
::requires "rxregexp.cls"
Table 5.43. ooRexx RegularExpression Class
| Object |
| ↓ |
| RegularExpression |
::require "rxregexp.cls" |
init match parse pos position |
Note
| | |
OR operator between the left and right expression
|
| ? |
Matches any single character
|
| * |
Matches the previous expression zero or more times
|
| + |
Matches the previous expression one or more times
|
| \ |
"Escape" symbol: use the next character literally
|
| () |
Expression in parenthesis (use where needed)
|
| {n} |
Matches previous expression n times (n>1)
|
| [] |
Set definition: matches any single character out of the defined set.
A '^' right after the opening bracket means that none of the following characters should be matched.
A '-' (if not used with '\') defines a range between the last specified character and the one following '-'. If it is the first character in the set definition, it is used literally.
|
| :ALPHA: |
Characters in the range A-Z and a-z
|
| :LOWER: |
Characters in the range a-z
|
| :UPPER: |
Characters in the range A-Z
|
| :DIGIT: |
Characters in the range 0-9
|
| :ALNUM: |
Characters in :DIGIT: and :ALPHA:
|
| :XDIGIT: |
Characters in :DIGIT:, A-F and a-f
|
| :BLANK: |
Space and tab characters
|
| :SPACE: |
Characters "09"x to "0D"x and space
|
| :CNTRL: |
Characters "00"x to "1F"x and "7F"x
|
| :PRINT: |
Characters in the range "20"x to "7E"x
|
| :GRAPH: |
Characters in :PRINT: without space
|
| :PUNCT: |
All :PRINT: characters without space and not in :ALNUM:
|
Example 5.194. Class REGULAREXPRESSION
::requires "rxregexp.cls"
"(Hi|Hello) World" Matches "Hi World" and
"Hello World".
"file.???" Matches any file with three
characters after "."
"file.?{3}" Same as above.
"a *b" Matches all strings that begin with
"a" and end with "b" and have an
arbitrary number of spaces in between
both.
"a +b" Same as above, but at least one space
must be present.
"file.[bd]at" Matches "file.bat" and "file.dat".
"[A-Za-z]+" Matches any string containing only
letters.
"[:ALPHA:]+" Same as above, using symbolic names.
"[^0-9]*" Matches any string containing no
numbers, including the empty string.
"[:DIGIT::LOWER:]" A single character, either a digit or
a lower case character.
"This is (very )+nice." Matches all strings with one or more
occurrences of "very " between
"This is " and "nice.".