简体   繁体   中英

XML-Schema type regex or pattern for regex

I want to validate if 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM