回答編集履歴

2

調整

2018/10/22 05:55

投稿

yambejp
yambejp

スコア114843

test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  ```javascript
22
22
 
23
- ["testhoge","test'","test\"","test=","test-","test&39;","test""].forEach(function(x){
23
+ ["testhoge","test'","test\"","test=","test-","test&39;","test"","hogehoge"].forEach(function(x){
24
24
 
25
25
  console.log("1)"+x+":"+(!x.match(/test(?=\x22|\x27|\x2d|\x3d)/)?"ok":"ng"));
26
26
 

1

追記

2018/10/22 05:55

投稿

yambejp
yambejp

スコア114843

test CHANGED
@@ -13,3 +13,21 @@
13
13
  });
14
14
 
15
15
  ```
16
+
17
+
18
+
19
+ # 追記
20
+
21
+ ```javascript
22
+
23
+ ["testhoge","test'","test\"","test=","test-","test&39;","test""].forEach(function(x){
24
+
25
+ console.log("1)"+x+":"+(!x.match(/test(?=\x22|\x27|\x2d|\x3d)/)?"ok":"ng"));
26
+
27
+ console.log("2)"+x+":"+(!x.match(/test(?=[-=]|&(39|quot);)/)?"ok":"ng"));
28
+
29
+ console.log("3)"+x+":"+(x.match(/test(?![-=]|&(39|quot);)/)?"ok":"ng"));
30
+
31
+ });
32
+
33
+ ```