Skip to content

Instantly share code, notes, and snippets.

@dsdstudio
Last active February 11, 2016 14:30
Show Gist options
  • Save dsdstudio/7042351c05ed53d29efe to your computer and use it in GitHub Desktop.
Save dsdstudio/7042351c05ed53d29efe to your computer and use it in GitHub Desktop.
javascript regexp cookbook
var nonchar = /[^(가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9)]/gi;
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
var isEmail = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
var isHan = /[ㄱ-ㅎ가-힣]/g;
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
var pwregexp = /^.*(?=^.{8,}$)(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$%^&+=]).*$/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment