开发者

XML-Schema type regex or pattern for regex

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜