1.替换多个模板变量
var s="my javascript is very poor,who can help me?" var reg=/(w*)my(.*)is(.*)can(.*)/g alert(s.replace(reg,"$1his$2was$3could")); //输出 his javascript was very poor,who could help me?