JS reference of regular expression: var sEnd=new RegExp("s$"); ——String matching ending with s
Regular expression:
Verified characters:
has special meaning in regular expressions, they are:
^ $ . * ! : | / () [] {} We will research it later
If you use these punctuation marks as literals in regular expressions, they must be preceded by "" (escape character).
Other characters (such as @ and quotation marks) have no special meaning, and only match themselves according to the direct value in the regular expression. Note:——“”
Question: "A[B]C[D]E[F]G" is divided into two arrays, namely ACEG and [B][D][F].
Question:
Both are looking for the
[B][D][F] array. Which one is better?
Method 1: var test1 = test.match(/[(w)*]/g);
Method 2: var s = /[(w)*]/g; var result; var test1 = [];
while ((result = s.exec(test)) ! = null) { test1.push(result[0]); }
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