案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<body>
3
4
<script type="text/javascript">
5
6
var str="Every man in the world! Every woman on earth!";
7
patt=/man/g;
8
str2=str.replace(patt,"person");
9
document.write(str2+"<br />");
10
patt=/(wo)?man/g;
11
patt.compile(patt); 
12
str2=str.replace(patt,"person");
13
document.write(str2);
14
15
</script>
16
17
</body>
18
</html>
19