Argument | Required/ Optional | Description |
---|---|---|
subject | Required | String datatype. Passes the value you want to compare against the regular expression pattern. |
pattern | Required | String datatype. Regular expression pattern that you want to match. You must use perl compatible regular expression syntax. Enclose the pattern in single quotation marks. |
subPatternNum | Optional | Integer value. Subpattern number of the regular expression you want to match. Use the following guidelines to determine the subpattern number:
Default is 1. |
Syntax | Description |
---|---|
. (period) | Matches any one character. |
[a-z] | Matches one instance of a character in lower case. For example, [a-z] matches ab. Use [A-Z] to match characters in upper case. |
\d | Matches one instance of any digit from 0-9. |
\s | Matches a whitespace character. |
\w | Matches one alphanumeric character, including underscore (_) |
() | Groups an expression. For example, the parentheses in (\d-\d-\d\d) groups the expression \d\d-\d\d, which finds any two numbers followed by a hyphen and any two numbers, as in 12-34. |
{} | Matches the number of characters. For example, \d{3} matches any three numbers, such as 650 or 510. Or, [a-z]{2} matches any two letters, such as CA or NY. |
? | Matches the preceding character or group of characters zero or one time. For example, \d{3}(-{d{4})? matches any three numbers, which can be followed by a hyphen and any four numbers. |
* (asterisk) | Matches zero or more instances of the values that follow the asterisk. For example, *0 is any value that precedes a 0. |
+ | Matches one or more instances of the values that follow the plus sign. For example, \w+ is any value that follows an alphanumeric character. |
COBOL Syntax | perl Syntax | Description |
---|---|---|
9 | \d | Matches one instance of any digit from 0-9. |
9999 | \d\d\d\d or \d{4} | Matches any four digits from 0-9, as in 1234 or 5936. |
x | [a-z] | Matches one instance of a letter. |
9xx9 | \d[a-z][a-z]\d | Matches any number followed by two letters and another number, as in 1ab2. |
SQL Syntax | perl Syntax | Description |
---|---|---|
% | . * | Matches any string. |
A% | A.* | Matches the letter “A” followed by any string, as in Area. |
_ | . (a period) | Matches any one character. |
A_ | A. | Matches “A” followed by any one character, such as AZ. |
Employee_Name | Return Value |
---|---|
Stephen Graham Smith | Graham |
Juan Carlos Fernando | Carlos |