I\'m confused as to what the difference here is and why one works and the other does not. Can someone explain this?
//The string to search through var str =
In order to get the equivalent of /(\/\*)/g, you want new RegExp("(\\/\\*)", "g").
/(\/\*)/g
new RegExp("(\\/\\*)", "g")