|
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:
-
In the Design view, select the simple type you want to work with.
-
In the Properties view, click the Constraints tab,
then Patterns.
-
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.
-
To add the token to the regular expression, click Add.
-
To create the entire expression, repeat steps 4 - 6 as necessary.
-
When you are finished, click Next.
-
To test against the regular expression and see if
a match occurs, enter sample text.
-
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.
|
|