reg1 = /\b($trololo)\b/; reg2 = new RegExp('\\b($trololo)\\b'); alert(reg1.toString()==reg2.toString());