| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html> |
| <head> |
| <!-- /******************************************************************************* |
| * Copyright (c) 2000, 2005 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ --> |
| <link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" /> |
| <title>Adding a pattern facet to a simple type</title> |
| </head> |
| <body id="taddreg"><a name="taddreg"><!-- --></a> |
| |
| <h1 class="topictitle1">Adding a pattern facet to a simple type</h1> |
| <div><div class="skipspace"><p>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 <span class="uicontrol">Regular Expression</span> wizard.</p> |
| <p>To |
| add a pattern to a simple type, follow these steps</p> |
| </div> |
| <ol><li class="skipspace"><span>In the Graph view, select the simple type you want to work with.</span></li> |
| <li class="skipspace"><span>In the Properties view, click the <span class="uicontrol">Advanced</span> tab, |
| then the <span class="uicontrol">Pattern</span> tab.</span> The <span class="uicontrol">Pattern</span> tab |
| will only appear if the pattern facet is applicable to the base type of the |
| simple type.</li> |
| <li class="skipspace"><span>Click <span class="uicontrol">Add</span>.</span> The Regular Expression |
| Wizard opens.</li> |
| <li class="skipspace"><span>Select the token you want to add to the expression.</span></li> |
| <li class="skipspace"><span>Indicate how often you want the token to appear in order for a |
| match to succeed.</span> If you want the token to repeat, click <span class="uicontrol">Repeat</span> 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 <span class="uicontrol">Range</span> and |
| enter a minimum and maximum value.</li> |
| <li class="skipspace"><span>Click <span class="uicontrol">Add</span> to add the token to the regular |
| expression. </span></li> |
| <li class="skipspace"><span>Repeat the previous three steps as necessary to create the entire |
| expression.</span></li> |
| <li class="skipspace"><span>When you are finished, click <span class="uicontrol">Next</span>.</span></li> |
| <li class="skipspace"><span>(Optional) Enter some sample text to test against the regular expression |
| and see if a match occurs. </span></li> |
| <li class="skipspace"><span>Click<span class="uicontrol">Finish</span>. </span></li> |
| </ol> |
| <div class="skipspace">The regular expression will appear in the Pattern page.</div> |
| </div> |
| </body> |
| </html> |