正则表达式测试网页
<HTML>
<HEAD>
<TITLE> 正则表达式测试 </TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>正则表达式</TD>
<TD><TEXTAREA NAME="reg" ROWS="4" COLS="40"></TEXTAREA></TD>
</TR>
<TR>
<TD>匹配字符串</TD>
<TD><TEXTAREA NAME="str" ROWS="4" COLS="40"></TEXTAREA></TD>
</TR>
<TR><TD colspan="2"><INPUT TYPE="button" onclick="matching()" value = "matching."><TD><TR>
</TABLE>
<font id="result" />
</BODY>
</HTML>
<script>
function matching()
{
var re =new RegExp(reg.value,"ig");
if (re.test(str.value))
{
result.color = "Green";
result.innerHTML = "True";
}else{
result.color = "red";
result.innerHTML = "False";
}
}
</script>
<HEAD>
<TITLE> 正则表达式测试 </TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>正则表达式</TD>
<TD><TEXTAREA NAME="reg" ROWS="4" COLS="40"></TEXTAREA></TD>
</TR>
<TR>
<TD>匹配字符串</TD>
<TD><TEXTAREA NAME="str" ROWS="4" COLS="40"></TEXTAREA></TD>
</TR>
<TR><TD colspan="2"><INPUT TYPE="button" onclick="matching()" value = "matching."><TD><TR>
</TABLE>
<font id="result" />
</BODY>
</HTML>
<script>
function matching()
{
var re =new RegExp(reg.value,"ig");
if (re.test(str.value))
{
result.color = "Green";
result.innerHTML = "True";
}else{
result.color = "red";
result.innerHTML = "False";
}
}
</script>
posted on 2004-08-19 11:12 Goodspeed 阅读(1145) 评论(1) 编辑 收藏 举报