Pattern Matching
This activity creates custom tokens using regular expressions that look for information that follows a specific pattern. A token is a placeholder for a value that is determined when a workflow runs.
To set up this activity:
- Drag the activity from the toolbox pane and drop it in the Designer pane.
- In the properties pane, type a name and description of the activity.
- In the Regular Expression Tokens property box, click New pattern... to create a custom token.
- Next to Token Name, type a name for your custom token.
- Next to Input, type the value you want your pattern to apply to. Click the Token button (right arrow) to add a token.
- Next to Pattern, type a regular expression or click the Pattern Matching button to build a regular expression that will extract the desired information from the input. Show me a list of regular expressions
- Select Allow tokens in the expression to have tokens in your pattern be replaced by their value when the activity runs. Click the Token button (right arrow) to add a token. You may want to clear this checkbox if you have regular expression syntax that you don't want mistaken for a token. If this checkbox is cleared, tokens will not be replaced and token syntax will be interpreted as regular expression syntax.
- Under Options, clear Case sensitive if you do not want the pattern matching process to differentiate between capital and lowercase letters. Otherwise, leave it.
- In the drop-down under If multiple matches are found, specify the number of matches you want to return with the following options:
- First match only: Returns only the first value that matches the pattern.
Example: The input 123 456 789 with the pattern [0-9]+ returns 123.
- All matches (combined with no spaces): Returns all values as a single-valued token.
Example: The input 123 456 789 with the pattern [0-9]+ returns 123456789. It ignores the characters that do not match the pattern.
- All matches (as multi-value token): Returns all values as a multi-value token.
Example: The input 123 456 789 with the pattern [0-9]+ returns 123, 456, and 789 in a multi-value token.
- First match only: Returns only the first value that matches the pattern.
- Optional: Click Click here to test the pattern to validate your token. In the testing area, type a sample value in the Test Input text box. The information your regular expression extracted from the sample input value will appear under Result.
- Click OK.
In the Regular Expression Tokens property box, you can continue to edit the token by clicking the Edit button or delete the token by clicking the Delete button .
Note: You can use tokens created with this activity to create more tokens within the same activity. To reference a token created in this activity, the referenced token must be listed before the token that refers to it in the Regular Expressions Tokens property box.
You may want to disable activities if you only want to test specific sections of your workflow. To disable activities:
- Select an activity in the designer pane to highlight it.
- In the Description property box, clear Enable.