Last active
February 27, 2020 03:09
-
-
Save nicholasxjy/40340451dbfe4447e96622b18818395d to your computer and use it in GitHub Desktop.
some useful regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mobile phone numbers in china | |
const reg = /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/ | |
// image tag | |
const regex = /<img([\s\S]*?)src\s*=\s*(['"])([\s\S]*?)\2([^>]*)>/gi | |
// only chinese charactors and letters | |
const regex = /^[\u4e00-\u9fa5a-zA-Z]+$/ | |
const reg = /^(([^<>()[\]\\.,;:\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,}))$/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment