1.匹配用户名:/^[a-z0-9_-]{3,16}$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320241.jpg)
2.匹配密码:/^[a-z0-9_-]{6,18}$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320242.jpg)
3.匹配一个Hex值:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320243.jpg)
4.匹配一个Slug:/^[a-z0-9-]+$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320244.jpg)
5.匹配一个Email:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320245.jpg)
6.匹配一个URL:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320246.jpg)
7.匹配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]?)$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320247.jpg)
8.匹配HTML Tag: 1. /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
![](http://file.zhishichong.com/images/article/20160918/2013013011320248.jpg)