开发者

XML Schema Regular Expression

I'm having trouble with two regular expressions tha开发者_如何学Pythont I need to use to validate urls 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?


For e-mail :

<xsd:pattern value="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}"/>

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜