Home > Web Front-end > JS Tutorial > body text

js about regular expression application examples

小云云
Release: 2018-03-13 14:46:01
Original
2055 people have browsed it

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}
Copy after login


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?"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!