例如: 從資料庫抓出了如下的一段 HTML 碼
1 | < b >< font color = "#FF0000" >This is a test</ font ></ b > |
1 2 3 4 | < div id = "divMsg" ></ div > < script type = "text/javascript" > $("#divMsg").html("${msg}"); </ script > |
1 | < b >< font color = "#FF0000" >This is a test</ font ></ b > |
1 2 3 4 | < div id = "divMsg" ></ div > < script type = "text/javascript" > $("#divMsg").html("${msg}"); </ script > |
1 | Content-Disposition: inline; filename=data.xls |
1 2 3 4 5 | <? xml version = "1.0" encoding = "UTF-8" ?> < message > < from >yilin</ from > < content >copyright © 2008 Power by Test site</ content > < message > |
1 2 | < iframe NAME = "outer_frame" width = "100%" height = "100%" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <? xml version = "1.0" encoding = "utf-8" ?> < root > < h:table xmlns:h = http ://www.w3.org/TR/html4/> < h:tr > < h:td >Apples</ h:td > < h:td >Bananas</ h:td > </ h:tr > </ h:table > < f:name >African Coffee Table</ f:name > < f:width >80</ f:width > < f:length >120</ f:length > </ f:table > < table > < name >Microsoft Visual C# 2008 Step by Step</ name > < author >John Sharp</ author > </ table > </ root > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <? xmlversion = "1.0" encoding = "utf-8" ?> < root > < user > < account >John</ account > < name >王小明</ name > </ user > < user > < account >Mary</ account > < name >吳阿美</ name > </ user > < user > < account >David</ account > < name >徐丁丁</ name > </ user > </ root > |
利用 RegularExpressionValidator 進行檢查:
1 | ValidationExpression= "^.+\.((p|P)(d|D)(f|F))$" |
1 | ValidationExpression= "^.+\.((d|D)(o|O)(c|C))(x|X)?$" |
1 2 | ValidationExpression = "^.+\.(((g|G)(i|I)(f|F))|((j|J)(p|P)(e|E)?(g|G))|((p|P)(n|N)(g|G)))$" |
因為 RegularExpressionValidator 控制項, 沒有設定 Regular Expression case-insensitive 的地方, 所以只好用 (e|E) 的方式進行.
雖然看起來有點醜, 不過可以用就好.