Python 正则表达式验证URN
2014-10-15 09:43
771 查看
1. Check whether a string consists entirely of a valid URN Match: (?x)\Zurn: # Namespace Identifier [a-zA-Z0-9][a-zA-Z0-9-]{0,31}: # Namespace Speficic String [a-zA-Z0-9()+,\-.:=@;$_!*'%/?#]+ \Z Result: urn:nihao:nihao 2. Find a URN in a larger body of text Match: (?x)\burn: # Namespace Identifier [a-zA-Z0-9][a-zA-Z0-9-]{0,31}: # Namespace Speficic String [a-zA-Z0-9()+,\-.:=@;$_!*'%/?#]+ Result: urn:nihao:nihao urn:nihao:good 3. Find a URN in a larger body of text, assuming that punctuation at the end of the URN if part of the (English) text in which the URN is quoted rather than part of the URN itself (?x)\burn: # Namespace Identifier [a-zA-Z0-9][a-zA-Z0-9-]{0,31}: # Namespace Speficic String [a-zA-Z0-9()+,\-.:=@;$_!*'%/?#]*[a-zA-Z0-9+=@$/]
相关文章推荐
- Python 正则表达式验证zip code (U.S.邮政编码)
- Python 正则表达式验证传统日期
- Python 正则表达式验证十六进制为特定范围
- Python 正则表达式验证操作符
- Python 正则表达式验证十六进制数字
- Python 正则表达式验证Keywords
- Python 正则表达式验证ISO 8601日期和时间
- Python 正则表达式验证带分隔符的数字
- Python 正则表达式验证十进制数字
- Python 正则表达式验证单行注释
- Python 正则表达式验证信用卡号码
- Python 正则表达式验证ISBN
- Python 正则表达式验证U.K.邮政编码
- Python 正则表达式验证密码完整性
- Python 正则表达式验证浮点数
- Python 正则表达式验证Canadian邮政编码
- Python 正则表达式验证是否为素数
- Python 正则表达式验证数字化变量
- Python 正则表达式验证Identifiers
- Python验证Url地址的正则表达式