I'm having trouble with two regular expressions tha开发者_如何学Pythont 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?
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.
精彩评论