<html>
<head><title>test</title>
</head>
<body>
<textarea name="a" cols="100" rows="4">aaa</textarea>
<br>helloworld
<textarea name="b" cols="100" rows="5">bbb</textarea>
<br>helloworld
<textarea name="c" cols="100" rows="6">ccc</textarea>
</body>
</html>
求一JavaScript正则表达式,把所有的<textarea name="a" cols="100" rows="4">aaa</textarea>这类标签用他的值代替。结果为<html>
<head><title>test</title>
</head>
<body>
aaa
<br>helloworld
bbb
<br>helloworld
ccc
</body>
</html>
var str = ...;
var reg = /<textarea[^>]*>(.*?)<\/textarea>/ig;
str = str.replace(reg, "$1");
</script>