NIST XML Schema conformance test suite: generalized regular expressions for
the pattern facet.
The generalized regular expressions from which pattern specifications
are derived for the various types are as follows:
decimal::= \-?\d{0,t-f}(\.\d{1,f})?
Where:
\- is the optional negative sign
\d is any digit (same as [0-9]);
\. represents the decimal point;
t is the total number of digits in the string (ie the value of the totalDigits facet);
f is the number of digits in the fractional part of the number (ie the value of
the fractionDigits facet).
This pattern applies to decimal and all its derivatives, in combination with any
further constraints (e.g. for integer, fractionDigits must == 0).
gYear::= [1970-2030]
gYearMonth::= gYear \-((0,[1-9]) | (1,[0-2]))
date::= gYearMonth \-(([0-2],[0-9])|(3,[0-1]))
Note: Dates such as February 31 are disallowed.
time::= (([0-1],[0-9])|(2,[0-3])) ':' ([0-5],[0-9]) ':' ([0-5],[0-9])
dateTime::= date 'T' time
Note: Dates such as February 31 are disallowed.
gMonthDay::= \-\-((0,[1-9]) | (1,[0-2]))\-(([0-2],[0-9])|(3,[0-1]))
gDay::= \-\-\-(([0-2],[0-9])|(3,[0-1]))
gMonth::= \-\-((0,[1-9]) | (1,[0-2]))\-\-
duration::= 'P' [1970-2030] 'Y' ((0,[1-9]) | (1,[0-2])) 'M' (([0-2],[0-9])|(3,[0-1])) 'DT' (([0-1],[0-9])|(2,[0-3])) 'H' ([0-5],[0-9]) 'M' ([0-5],[0-9]) 'S'
double::= decimal 'E' [(-1075)-970]
float::= decimal 'E' [(-149)-104]
string::= \d{1, 5}\s([A-Z][a-z]{1, 20}\s){1, 5} 'Street' \n([A-Z][a-z]{1, 20}\s){1, 3},[A-Z]{2}\s\d{5}(\-\d{4})?
normalizedString::= \d{1, 5}\s([A-Z][a-z]{1, 20}\s){1, 5} 'Street' ([A-Z][a-z]{1, 20}\s){1, 3},[A-Z]{2}\s\d{5}(\-\d{4})?
token::= normalizedString
language::= ([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1, 8})(-[a-zA-Z]{1, 8})*
Name::= \i\c*
NCName::= Name
Note: ":" is disallowed.
ID::= NCName
boolean::= [0|1|true|false]
base64Binary::= [a-zA-Z0-9+/]+
hexBinary::= [0-9A-F]+
anyURI::= [http://|http://www.|ftp://|ftp://ftp.|telnet://|gopher://](\c+)[.com|.edu|.org|.gov]
QName::= (NCName ':')?NCName