日期:2009-05-02  浏览次数:20889 次

前段时间差不多都要和正则表达式打交道,所以当时就弄了这个测试练习页面.把以下代码保存为一个HTML文件用IE打开即可使用:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>正则表达式测试</title>
<style type="text/css">
<!--
td {
font-family: "宋体";
font-size: 12px;
color: #666666;
text-decoration: none;
}
input {
font-family: "宋体";
font-size: 12px;
color: #666666;
text-decoration: none;
border: 1px solid #000000;
height: 18px;
}
textarea {
font-family: "宋体";
border: 1px solid #333333;
word-spacing:inherit
}
.table {
font-family: "宋体";
font-size: 12px;
border: 1px solid #000000;
white-space: normal;
table-layout: fixed;
WORD-BREAK: break-all;
WORD-WRAP: break-word;
display: table;
}
.checkbox {
border: 1px dotted #CCCCCC;
}
-->
</style>
</head>

<body>
<table width="100%" height="306" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><div align="center">
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<textarea name="InputBox" cols="100" rows="20" id="InputBox"></textarea>
</div></td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1"></td>
</tr>
</table>
<table width="722" border="0" cellpadding="0" cellspacing="1" class="table">
<tr>
<td height="25" bgcolor="#F2F2F2"><div align="center">正则表达式:
<input name="RegExpBox" type="text" id="RegExpBox" size="100">
</div></td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1"></td>
</tr>
</table>
<table width="722" border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="580" height="25" bgcolor="#F2F2F2"><div align="center">
<input name="SingleLine" type="checkbox" class="checkbox" value="1">
<span title="将更改(.)的意思,使它包含所有字符">单行模式查找</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="IgnoreCase" type="checkbox" class="checkbox" value="1">
<span title="不区分字母的大小写">不区分大小写</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="Global" type="checkbox" class="checkbox" value="1">
<span title="查找所有的可匹配项">全局模式查找</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;