javascript当中正则表达式用法
6.正则表达式
例 6.1(replaceIEFF.html)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<SCRIPT LANGUAGE="JavaScript">
<!--
function rep()
{
var f = document.getElementById("sec").value;
f= f.replace(/tmd/g,"*");
document.getElementById("fir").value=f
document.getElementById("sec").value="";
}
//-->
</SCRIPT>
</HEAD>
<BODY >
<TEXTAREA id="fir" NAME="" ROWS="4" COLS="40"></TEXTAREA><p>
<input id="sec" NAME="" size="60" value="tmd is, then press 'enter'">
<INPUT TYPE="button" value="发送" οnclick="rep()">
</BODY>
</HTML>
更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44639795/article/details/101933187