I want to validate i开发者_C百科f a certain attribute is a valid regex. Is there some direct built in type in xml schema maybe xs:regex
?
Otherwise is there a regex that defines valid regexes?
There is, by definition, no regex that can validate regular expressions.
Regular expressions can match regular languages, they are not themselves a regular language. Much like there can be no regular expression to validate HTML or JavaScript.
To find out if a string is a legal regular expression, it's easiest to try and create a regex object from it. In XSD itself this is impossible, so you'd need the help of an external tool.
精彩评论