# Adding pattern facets to simple types

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, complete the following steps:

1. In the Design view, select the simple type you want to work with.
2. In the Properties view, click the Constraints tab, then Patterns.
3. Click Add. The Regular Expression wizard opens.
4. Select the token you want to add to the expression.
5. 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.
6. To add the token to the regular expression, click Add.
7. To create the entire expression, repeat steps 4 - 6 as necessary.
8. When you are finished, click Next.
9. To test against the regular expression and see if a match occurs, enter sample text.
10. Click Finish. The regular expression will appear in the Patterns page.
    Tip: To edit an existing pattern, select it in the Patterns page and click Edit. To delete an existing pattern, select it in the Patterns page and click Delete.

Related tasks
Adding simple types