Modifiers
i:match ignore case
g:match global
m:match mult-line
regexp mode
about [] or ():
[abc]:match content in [],eg:[0-9] match number in 0-9
(x|y):match content split by "|"
about single character:
\d: number
\s: white space
\b: end of word
\uxxxx: Hex charactor
about quantifier
n+: content contains at least one 'n'
n*: content contains 'n' number amount 0 or n
n?: content contains 'n' number amount 0 or 1
Method for regexp
test()
var patt = /e/;
patt.test("The best things in life are free!");
exec()
/e/.exec("The best things in life are free!");
Commonly Method In Js
search()
var str = "Visit w3cschool!";
var n = str.search("w3cschool");
replace()
var str = "Visit Microsoft!";
var res = str.replace(/microsoft/i, "w3cschool");
> ___code form w3c