avaScript - Common regular expression

 

 

 

username / ^ [A-Z0-9 _-] {3,16} $ /
password / ^ [A-Z0-9 _-] {6.18} $ /
Hexadecimal value /^#?([a-f0-9]{6}|[a-f0-9]{3})$/
E-mail /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
/^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/
URL /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
IP addresses /((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)/
/^(?:(?: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 tags /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
Remove the code \\ comments (?<!http:|\S)//.*$
Character Unicode encoding range /^[\u2E80-\u9FFF]+$/

 

Guess you like

Origin www.cnblogs.com/sylys/p/11640443.html