- Contents
Interaction Designer Help
RegEx Extended
This System tool allows the parsing of a string based on a standard regular expression. You might use this tool to check and match IP, e-mail, or SIP addresses within a string. Or, you might use it to extract information, such as a call ID or phone number, from an e-mail message.
Inputs
String
The string to parse.
Expression
A string containing the regular expression with which the string is to be parsed. The regular expression uses the following escape sequences:
|
“*” |
Represents the zero or more repetition operator. |
|
“+” |
Represents the one or more repetition operator. |
|
“?” |
Represents the zero or one repetition operator. |
|
“[“ and “]” |
Used to specify character ranges (sets). Use a dash to specify a range, such as “[a-z]”. |
|
“[^” and “]” |
Used to specify character ranges not to match. For example, “[^0-9]” would match a non-number. |
|
“{“ and “}” |
Used for bounded repetitions. |
|
“(“ and “)” |
Used to group sub-expressions. You can also use this to specify captures. |
|
“|” |
Represents the alternation operator. |
The expression syntax supported in this tool uses the regex_search algorithm with match_continuous. This combination only matches a string sequence where the first character matches the provided regular expression. For more information, see http://www.boost.org.
So for example, to find an IP address in a String, the expression might look like this:
"([0-9]{1,3}+\.[0-9]{1,3}+\.[0-9]{1,3}+\.[0-9]+)"
Note: To get a single slash in the actual string at runtime, you need to enter double slashes. For example, to get the string "\+" you need to enter "\\+" in the Interaction Designer editor.
Format
The format is used to specify the output of the regular expression. It is very important that at least one capture is specified in the regular expressions. A capture is specified using “(“ and “)”. The first capture is represented as “$1”, the second as “$2”, and so on.
Case sensitive
When this check box is selected, case-insensitive comparisons are used. Clear this check box if you do not want the comparisons to be case-sensitive.
Repeat
It is possible to do a partial match of the input string. If there is a possibility for multiple matches, this option will continue searching until the input string is consumed, or a match does not consume anything.
Multi-Output
If a single match should return multiple outputs, then this option should be checked. When used, the first character in the format string is used as the output delimiter. For example, if the regular expression captured two pieces of information that needed to be output as two separate items, then the format would be “;$1;$2”. The first character indicates that the ‘;’ delimits the outputs. In this case, “$1” and “$2” are the separate outputs.
Outputs
Result
A string list containing the results of the expression applied to the parsed string.
Remainder
Because a partial match is possible, this string returns any input string that was not matched.
Exit Paths
Full Match
This path is taken if the input string is fully matched.
Partial Match
This path is taken if matches were found, but the input was not fully matched.
No Match
This path is taken if no matches were found.
Failure
This path is taken if there is an error in the regular expression. An example of an error would be the expression "one|" because the or operator is used without specifying the alternative.
Examples
The following example shows how to find all of the call IDs and phone numbers from an e-mail message.
String:
13:43:59: Initializing
13:43:59: Offering
13:44:06: Voice Mail
13:44:27: Disconnected [Remote Disconnect]
13:44:27: Caller has recorded and sent a Voicemail message
6 seconds
[ID: 2000061016#3173452098]
------------------------------------------
13:43:59: Initializing
13:43:59: Offering
13:44:06: Voice Mail
13:44:27: Disconnected [Remote Disconnect]
13:44:27: Caller has recorded and sent a Voicemail message
6 seconds
[ID: 2013061017#3173451234]
Expression:
.*?\\[ID:[ \\t]*([0-9]+)#([0-9]+)\\]
Format:
;ID=$1;Number=$2
Repeat:
On
Multi-Output:
On

