Creating Regular Expressions for Interact
The Regular Expressions page enables you to define Regular Expression (Regex) patterns for your account.
X-Designer can use your patterns in various functions, for example, to mask sensitive customer information that is written to X‑Platform Integration Point (IP) logs.
X‑Platform Regular Expressions adhere to the Java standard.
Creating a Regex Pattern
From the Settings section of the X-Console, click Regular Expressions. The Regular Expressions page is displayed:
Above the table of expressions at the left, click Add Expression. A new row appears in the table.
In the Name column, enter a name for the new expression.
In the Regular Expression column, enter the Regex search pattern you want to use. X‑Platform uses JavaScript regular expressions.
Note
X-Designer does not perform syntax checking on the expression you enter.
In the Example column, enter a valid instance of the data value you want to find. (The example is for assistance only and is not used to validate the Regex pattern.)
Click the Active switch to toggle the new expression On or Off. By default, a new expression is always set to Active.
Testing a Regex Pattern In the text field at the top of page, enter sample data for testing. For best results, copy the sample directly from some X‑Platform output (e.g., a response field or a data log).
Click Test.
The data sample will be analyzed, and any expression that matches its pattern will display a green checkmark in its Test Result column.
Any expression that does not match the tested data sample will display a red X in its Test Result column.
When you have finished creating and testing your pattern(s), click Save to store the updated table.
You can create unique Regex pattern tables for each environment (i.e., DEV, TEST PROD) you work in. The Regex table remains associated with that environment.
Editing a Regex Pattern
From the Settings section of the X-Console, click Regular Expressions. The Regular Expressions page is displayed.
Change the desired expression(s) in the table of expressions.
When the list is long, you can locate a specific expression by entering a few letters from its Name in the Search field at the upper right corner of the table.
To delete an expression, click the Trashcan
icon at the right side of the expression.
Be sure to perform a new Test on any edited Regex pattern.
When you have finished editing your expression(s), click Save to store the updated table.
Edits to a Regex pattern are unique to the environment you are currently using (i.e., DEV, TEST PROD).
Some Example Regex Patterns
Several typical pattern examples are provided on the Regular Expressions page to get you started. Below are some additional pattern examples that also might be useful for Interact.
When creating a Regex pattern in Interact, it's best practice to make it as specific to your use case as possible. For example, if your customers are located only in the US, you should create a pattern that will validate only US-based phone numbers.
When using Regex to mask sensitive data for an Integration Point, remember that the IP Response can also be used to filter the data passed to your Flow, potentially reducing the complexity that is required by your Regex pattern.
Type | Example Regex Pattern |
Email Address | Simple validation: ^(.+)@(.+) Above returns true without checking for valid characters or subdomain periods. Strict validation: [a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+ Above returns true after checking for valid RFC characters and subdomain periods. |
US Phone Number | \(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4}) Above returns true with or without any delimiters. Example: (212) 321-4567 or 2123214567 |
Zip+4 | [0-9]{5}-[0-9]{4} Example: 12345-6789 |
X‑Platform Regex syntax adheres to the Java language. For a complete programming language reference, see the following sources: