Reputation: 1
Could anyone please explain the following regular pattern means or what would be a valid value, I mean total how many character should be an so on.
< xsd:simpleType name="GuidType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}" />
</xsd:restriction>
</xsd:simpleType>
Thanks
Upvotes: 0
Views: 140
Reputation: 3109
total regular expression
[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}
Breaks up in
[0-9A-F]{8} > explains : 8 chars that would be in set 0123456789ABCDEF
- > explains: match character -
[0-9A-F]{4} > explains : 4 chars that would be in set 0123456789ABCDEF
- > ..
[0-9A-F]{4} > ..
- > ..
[0-9A-F]{4} > ..
- > ..
[0-9A-F]{12} > explains : 12 chars that would be in set 0123456789ABCDEF
Upvotes: 0
Reputation: 9989
This is what is called a GUID, commonly used in the "uniqueidentifier" type in SQL. It's a set of 5 groups of hexadecimal digits: a grouping of 8 digits, then a hyphen, then 4 digits, then a hyphen, then 4 digits again, then a hyphen, then 4 digits AGAIN, then a hyphen, then 12 digits. Hexadecimal digits are the numerals 0 through 9 and the letters A through F. Altogether (with hyphens included) this is a 36-digit string.
So for example, a valid string might look like this:
3B3AC4DC-3DEB-4241-99BD-5611A68C4CF3
Upvotes: 1