Pattern for time : pattern « XML Schema « XML Tutorial






<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.java2s.com" xmlns="http://www.java2s.com"
  elementFormDefault="qualified">

  <xsd:element name="gestation">
    <xsd:simpleType>
      <xsd:restriction base="xsd:time">
        <xsd:pattern value="P\d+D" />
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>
</xsd:schema>








3.79.pattern
3.79.1.Pattern syntax
3.79.2.list of atoms that match a single character
3.79.3.Character classes
3.79.4.Unicode character classes
3.79.5.User-defined character classes
3.79.6.Meta Characters
3.79.7.These three characters should be used with caution:
3.79.8.A character class expression is simply a character group, enclosed in square brackets
3.79.9.Any single normal character will match only that character
3.79.10.Special regex characters (-[]) cannot be used for the single normal character form of the character range.
3.79.11.Any ASCII letter: adding a second character range to the character group expression
3.79.12.To match a string of any length (including the empty string) that is comprised exclusively of lower-case ASCII letters
3.79.13.Specifying a Pattern for a Simple Type
3.79.14.Pattern for time
3.79.15.You can use patterns to offer choices for an element's content.
3.79.16.Getting rid of leading zeros
3.79.17.Use quantifiers to limit the number of leading zeros-for instance
3.79.18.Merge our three patterns into one
3.79.19.pattern Constrains the lexical space to literals that must match a defined pattern
3.79.20.A phone number
3.79.21.Define a pattern that can be used for zip codes
3.79.22.pattern: USA_SSN datatype