Not running a regular expression to remove special characters in JS, what's wrong?

Why doesn't this design ? While in php everything is fine 0_o
"& ".replace('/&.*;/', ");
July 9th 19 at 11:20
1 answer
July 9th 19 at 11:22
You have the regular expression in quotes, that is is searched for a substring.
Try this:
"& ".replace(/[&.*;]/g, ");
A little different but thanks =)
var re = new RegExp("&.*;");
"&dsdsfsd; ".replace(re, "); - Carmel_Muell commented on July 9th 19 at 11:25

Find more questions by tags HTMLJavaScript