by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)

Using Regular Expressions to Specify Simple Datatypes

Table of Contents

9.1. A Swiss Army Knife
9.2. The Simplest Possible Pattern Facets
9.3. Quantifying
9.4. More Atoms
9.4.1. Special Characters
9.4.2. Wildcard
9.4.3. Character Classes
9.4.4. Or-ing and Grouping
9.5. Common Patterns
9.5.1. String Datatypes
9.5.2. Numeric and Float Types
9.5.3. Datetimes

Among the many facets available for restricting simple datatypes, the most flexible is based on regular expressions. The pattern facet can be a last resort when all the other facets are unable to express needed restrictions on a user-defined datatype.


There is a terminology clash between RELAX NG's patterns and the pattern facet of W3C XML Schema. To limit the risk of confusion, I refer to the facet as the pattern facet or "regular expression."

This text is released under the Free Software Foundation GFDL.