Home  >  Article  >  Web Front-end  >  JavaScript Study Notes (11) Introduction to Regular Expressions_Basic Knowledge

JavaScript Study Notes (11) Introduction to Regular Expressions_Basic Knowledge

WBOY
WBOYOriginal
2016-05-16 17:52:37977browse

1. Modifier
. Any character
* matches * the preceding 0 or more characters
matches the preceding one or more characters
? matches ? the preceding 0 or 1 character
^ is preceded by the character after ^
$ ends by the character before $
[] matches a character within []
() grouping, you can use 1 2 to extract
[^] matches ^ Characters other than the ones after
{n} There are n characters before {n}, n is a positive number
{n,} {n,} There are at least n characters before it, n is a positive number
{n,m} There are n~m characters before {n,m}, n,m is a positive number

2. Characters
d a number
D a non-number
w a letter or number
W a non-letter and non-number
s a whitespace character
S a non-whitespace character
b word boundary
B non-word boundary

3. Non-greedy matching
? *? ??

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