匹配中文:[\u4e00-\u9fa5]
英文字母:[a-zA-Z]
数字:[0-9]
匹配中文,英文字母和数字及_:
^[\u4e00-\u9fa5_a-zA-Z0-9]+$
同时判断输入长度:
[\u4e00-\u9fa5_a-zA-Z0-9_]{4,10}
^[\w\u4E00-\u9FA5\uF900-\uFA2D]*$ 1、一个正则表达式,只含有汉字、数字、字母、下划线不能以下划线开头和结尾:
^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$ 其中:
^ 与字符串开始的地方匹配
英文字母:[a-zA-Z]
数字:[0-9]
匹配中文,英文字母和数字及_:
^[\u4e00-\u9fa5_a-zA-Z0-9]+$
同时判断输入长度:
[\u4e00-\u9fa5_a-zA-Z0-9_]{4,10}
^[\w\u4E00-\u9FA5\uF900-\uFA2D]*$ 1、一个正则表达式,只含有汉字、数字、字母、下划线不能以下划线开头和结尾:
^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$ 其中:
^ 与字符串开始的地方匹配
group和groups是两个不同的函数。
一般,m.group(N) 返回第N组括号匹配的字符。
而m.group() == m.group(0) == 所有匹配的字符,与括号无关,这个是API规定的。
m.groups() 返回所有括号匹配的字符,以tuple格式。
m.groups() == (m.group(0), m.group(1), ...)
If you dont't want HTML escaped, look at the safe
filter and the autoescape
tag
FILTER: {{ myhtml |safe }}
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe
TAG: {% autoescape off %}{{ myhtml }}{% endautoescape %}
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#autoescape