Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
56 lines (39 loc) · 1.15 KB

File metadata and controls

56 lines (39 loc) · 1.15 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正则表达式</title>
<script type="text/javascript">
/*
教程w3cschool 菜鸟教程 新版本.chm 教程
*/
/*
//第一部分 方括号的 正则表达式
var patt = new RegExp("[abc]") // 第一种正则表达式对象
var patt1 = /[abc]/; //第二种正则表达式对象
alert(patt1);
if (patt1.test("b")) {
alert(" 正则表达式 范围之内的,OK!")
} else {
alert(" 正则表达式 错误,不在范围内!")
}
*/
//[^abc] 查找任何不在方框内的字符串
/* var patt=/[^abc]/;
var str="mm";
alert(patt.test(str));
*/
/* //[0-9] 查找任何从0 到 9 的数字
var patt=/[0-9]/;
var str="a";
alert(patt.test(str));
*/
//第二部分 元字符的 正则表达式
var patt=/\w/; //单词字符:包括 a-z,A-Z,0-9 以及下划线,包好_字符
var str="12";
alert(patt.test(str));
</script>
</head>
<body>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.