日期:2014-05-16  浏览次数:20403 次

js中使用正则表达式实现replaceAll方法

http://www.360doc.com/content/11/0407/20/2956608_108008354.shtml

<html>
	<head>
		<title></title>
		<script language="javascript">
function replaceAll()
{
var oldValue = "abcdea";
var newValue = oldValue.replace(new RegExp("\a","gm"),"x");
alert("oldValue="+oldValue+"\n"+"newValue="+newValue);
}
replaceAll();
</script>
	</head>
	<body>

	</body>
</html>
?