打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Django正则表达式
正则表达式
Regular expressions (or regexes ) are a compact way of specifying patterns in text. While Django URLconfs allow arbitrary regexes for powerful URL-matching capability, youll probably use only a few regex patterns in practice. Heres a small selection of common patterns:
正则表达式 (或 regexes ) 是通用的文本模式匹配的方法。Django URLconfs 允许你 使用任意的正则表达式来做强有力的URL映射,不过通常你实际上可能只需要使用很少的一 部分功能。下面就是一些常用通用模式:
SymbolMatches
. (dot)Any character
\dAny digit
[A-Z]Any character, A-Z (uppercase)
[a-z]Any character, a-z (lowercase)
[A-Za-z]Any character, a-z (case insensitive)
+One or more of the previous expression (e.g., \d+ matches one or more digit)
[^/]+All characters except forward slash
Zero or more of the previous expression (e.g., \d* matches zero or more digits)
{1,3}Between one and three (inclusive) of the previous expression
符号匹配
. (dot)任意字符
\d任意数字
[A-Z]任意字符, A-Z (大写)
[a-z]任意字符, a-z (小写)
[A-Za-z]任意字符, a-z (不区分大小写)
+匹配一个或更多 (例如, \d+ 匹配一个或 多个数字字符)
[^/]+不是/的任意字符
*匹配0个或更多 (例如, \d* 匹配0个 或更多数字字符)
{1,3}匹配1个到3个(包含)
For more on regular expressions, see http://www.djangoproject.com/r/python/re-module/.
有关正则表达式的更多内容,请访问 http://www.djangoproject.com/r/python/re-module/.
通过.http://djangobook.py3k.cn/chapter03/ecn/
Posted by ian at 02:02 Tagged with: Django
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
POSIX正则表达式
Python正则表达式入门
VSCode查找和替换正则表达式转义字符整理
PHP中关于正则表达式匹配任意字符(包括换行符)的写法
正则表达式匹配任意字符(能换行匹配)的写法
在Unix和Mac上的Shell编程(正则表达式)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服