Reputation: 449
I'm using following pattern in xsd
(^$)|(^([1-2]\d{3}-([0]?[1-9]|1[0-2])-([0]?[1-9]|[1-2][0-9]|3[0-1]))[ |T]?((([0-1]?\d)|(2[0-3])):[0-5]\d)?(:[0-5]\d)?(\.\d{1,3})?$)
While testing, it is failing for value - '2013-01-01T23:59:46'
Could anyone please let me know what's wrong with the regex?
Upvotes: 1
Views: 128
Reputation: 25034
You're using ^
and $
to indicate anchors at the beginning and end of the string being matched. But XSD patterns are always anchored, and the characters ^
and $
just denote literal caret and dollar-sign respectively. Drop them and try again.
Upvotes: 2