Home  >  Article  >  Web Front-end  >  js about regular expression application examples

js about regular expression application examples

小云云
小云云Original
2018-03-13 14:46:012057browse

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










##Related recommendations:


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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn