Adding a pattern facet to a simple type
A pattern facet can be used to constrain the value of a type's lexical space (the set of string literals that represent the values of a type), which indirectly constrains the value space. The value of the pattern is called a regular expression. You can specify it using the Regular Expression wizard.
To add a pattern to a simple type, follow these steps
- In the Graph view, select the simple type you want to work with.
- In the Properties view, click the Advanced tab, then the Pattern tab. The Pattern tab will only appear if the pattern facet is applicable to the base type of the simple type.
- Click Add. The Regular Expression Wizard opens.
- Select the token you want to add to the expression.
- Indicate how often you want the token to appear in order for a match to succeed. If you want the token to repeat, click Repeat and specify the number of times the token must appear. If you want to specify a minimum and maximum number of times the token can appear, click Range and enter a minimum and maximum value.
- Click Add to add the token to the regular expression.
- Repeat the previous three steps as necessary to create the entire expression.
- When you are finished, click Next.
- (Optional) Enter some sample text to test against the regular expression and see if a match occurs.
- ClickFinish.
The regular expression will appear in the Pattern page.