# 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

1. In the Graph view, select the simple type you want to work with.
2. 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.
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. Click Add to add the token to the regular expression.
7. Repeat the previous three steps as necessary to create the entire expression.
8. When you are finished, click Next.
9. (Optional) Enter some sample text to test against the regular expression and see if a match occurs.
10. ClickFinish.

The regular expression will appear in the Pattern page.

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.