这是:
var txt=new RegExp(pattern,attributes);
相当于:
var txt=/pattern/attributes;
见 http://www.w3schools.com/jsref/jsref_obj_regexp.asp .