Skip to content

Instantly share code, notes, and snippets.

@Andyliwr
Last active June 21, 2019 06:41
Show Gist options
  • Save Andyliwr/50d68e1870d6356d5b3841841d89dba4 to your computer and use it in GitHub Desktop.
Save Andyliwr/50d68e1870d6356d5b3841841d89dba4 to your computer and use it in GitHub Desktop.
常用正则
// 校验密码包含数字和字母,且长度在6到30个字符
/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,30}$/
// 手机号码加密
'18883339779'.replace(/(\d{3})(\d{4})(\d{4})/, '$1****$3')
// 匹配中文,字母,数字,或者下划线
[a-zA-Z0-9_-/u4e00-/u9fa5]+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment