Home  >  Article  >  php教程  >  php 常用正则表达式 邮箱 用户名 密码 ip html标签

php 常用正则表达式 邮箱 用户名 密码 ip html标签

WBOY
WBOYOriginal
2016-06-08 17:28:511172browse
<script>ec(2);</script>

用户名

/^[a-z0-9_-]{3,16}$/

密码

/^[a-z0-9_-]{6,18}$/

十六进制值

/^#?([a-f0-9]{6}|[a-f0-9]{3})$/

电子邮箱

/^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/

URL

/^(https?://)?([da-z.-]+).([a-z.]{2,6})([/w .-]*)*/?$/

IP 地址

/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

HTML 标签

/^(.*)1>|s+/>)$/

Unicode编码中的汉字范围

/^[u4e00-u9fa5],{0,}$/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn