XML 模式正则表达式
我在使用两个正则表达式时遇到问题,需要使用这两个正则表达式来验证 xsd
文件中的 url
。
据我所知,与其他系统相比,Schema
使用正则表达式的方式略有不同。
有没有人有任何有效的正则表达式来单独验证 XSD
架构中的 url
和 email
?
I'm having trouble with two regular expressions that I need to use to validate url
s in an xsd
file.
I understand that there is a slight difference in how Schema
uses regex compared to other systems.
Does anyone have any valid regex to separately validate a url
and an email
in XSD
schema?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于电子邮件:
xsd 模式并不总是暗示锚点,因此这应该与您的整个字符串匹配。
编辑:上面的正则表达式非常基本。我建议您阅读以下内容:
使用正则表达式进行验证电子邮件地址
了解更多信息。关于 url,根据您希望验证的复杂程度,您可以使用大约一百万个正则表达式。至少可以说,模式正则表达式相当有限。
For e-mail :
Not that xsd schema always implies anchors so this should have to match your entire string.
Edit : Above regex is pretty basic. I suggest you read this :
Using a regular expression to validate an email address
For more info. Regarding the url, depending on how complex you want your validation to be there are about a million regexes you could use. And schema regex is rather limited to say the least.