forked from ygs-code/vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exex.html
53 lines (45 loc) · 1.25 KB
/
exex.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var text="cat,bat,sat,fat";
var pattern1=/.at/g;
var matches=pattern1.exec(text);
var matches1=pattern1.exec(text);
var matches2=pattern1.exec(text);
var matches3=pattern1.exec(text);
var matches4=pattern1.exec(text);
console.log(matches)
console.log(matches1)
console.log(matches2)
console.log(matches3)
console.log(matches4)
// console.log(matches.index);//0
// console.log(matches[0]);//cat
// console.log(pattern1.lastIndex);//3
matches=pattern1.exec(text);
// console.log(matches)
// console.log(matches.index);//5
// console.log(matches[0]);//bat
// console.log(pattern1.lastIndex);//7
// var str = "abc123";
// var re = /a.c/g
// var result1 = re.test(str);
// var result2 = re.test(str);
// var result3 = re.test(str);
// var result4 = re.test(str);
// var result5 = re.test(str);
// var result6 = re.test(str);
// console.log(result1)
// console.log(result2)
// console.log(result3)
// console.log(result4)
// console.log(result5)
// console.log(result6)
</script>
</body>
</html>