-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwhile+正则exec匹配暂停.html
32 lines (32 loc) · 951 Bytes
/
while+正则exec匹配暂停.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script type="text/javascript">
var tagRE = /\{\{\{(.+?)\}\}\}|\{\{(.+?)\}\}/g
var htmlRE = /^\{\{\{.*\}\}\}$/
var text = "{{{eeee}}} {{dadasdsa}}"
var match,index,html,value,first,oneTime
var tokens = []
while (match = tagRE.exec(text)) {
console.log(match)
// console.log(match)
//// index = match.index;
// html = htmlRE.test(match[0])
// value = html ? match[1] : match[2]
// first = value.charCodeAt(0);
// oneTime = first === 42; // *
// value = oneTime ? value.slice(1) : value;
// tokens.push({
// tag: true,
// value: value.trim(),
// html: html,
// oneTime: oneTime
// })
}
</script>
</body>
</html>