开发者

XML-Schema type regex or pattern for regex

开发者 https://www.devze.com 2023-04-03 13:23 出处:网络
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?

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

精彩评论

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