I have the following string:
[27564][85938][457438][273][48232] I want to replace all the [ with ''. I tried the following but it didn't work:
var str = '[27564][85938][457438][273][48232]' var nChar = '['; var re = new RegExp(nChar, 'g') var visList = str.replace(re,''); what am I doing wrong here?
Many thanks in advance.
RegExpinstead of/.../g? Could the value of nChar change?