This article mainly shares with you JS regular expression application examples, hoping to help everyone. Tool regexper/.com regular tool (may be a bit slow in China), we can try to install the source code on github.
2006/02/03
test/07/sd
2016/05/10
1997-03-07
1992-02 -45
2018-45-05
123456/23/458
1234/23/4795
//用中括号表示或者//用花括号表示次数{4} {4,} 大于4次 {4,8} 4到8次 \d{4}[/-]\d{2}[/-]\d{2}
g represents the global meaning
var reg = /\bis\b/g; 'He is a body.This is a dog.Where is she?'.replace(reg,'Is') "He Is a body.This Is a dog.Where Is she?"
Constructor
RegExp()
Modifiers
g: Global match
i: Case-insensitive
m: What a good search
Metacharacters
1. The literal text character a abc matches a abc
2. Metacharacters are non-letter characters with special meanings in regular expressions * ^ $ {} [] () .
Character class
##Greedy Mode
10 application examples of js regular expressions
JS regular expressions How to replace url parameters
15 commonly used js regular expressions
The above is the detailed content of js about regular expression application examples. For more information, please follow other related articles on the PHP Chinese website!