Return to Snippet

Revision: 24664
at March 8, 2010 04:51 by tennison


Initial Code
var regex = new RegExp(o.validate);
var result = regex.test(value);
// result = true / false

//tests
password : /^[a-z0-9_-]{6,18}$/ 
RGB hex  : /^#?([a-f0-9]{6}|[a-f0-9]{3})$/
Email    : /^([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 tag :/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/

Initial URL

                                

Initial Description

                                

Initial Title
Regulare expression - test + useful expressions

Initial Tags
regexp

Initial Language
JavaScript