-
Notifications
You must be signed in to change notification settings - Fork 0
/
0815-06-pattern.html
33 lines (31 loc) · 1.33 KB
/
0815-06-pattern.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>input pattern</title>
</head>
<body>
<form action="" onsubmit="return false;">
<input type="number" min="10" max="99" step="1" placeholder="年齡">
<br>
<input type="text" placeholder="手機號碼"
required
pattern="09\d{2}-?\d{3}-?\d{3}">
<!-- 09
\d數字{2位}
-? ?是重複一次或0次
0987-654-321
0987654321
-->
<!-- required 必填欄位設定-->
<br>
<input type="email" placeholder="信箱"
required
pattern="(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])">
<br>
<input type="submit">
</form>
</body>
</html>