Home > Web Front-end > JS Tutorial > Rookie javascript basic information compilation 3 regular rules_basic knowledge

Rookie javascript basic information compilation 3 regular rules_basic knowledge

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:14:29
Original
1183 people have browsed it

1.js regular expression (RegExp object)
RegExp object has 3 methods: test(), exec() and compile().
①test() method
//The test() method retrieves the specified value in the string. The return value is true or false.
var patt1=new RegExp("e");
document.write(patt1.test("The best things in life are free"));
②exec() method
//exec () method retrieves a specified value in a string. The return value is the found value. If no match is found, null is returned.
var patt1=new RegExp("e");
document.write(patt1.exec("The best things in life are free"));
To be continued.

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