I am trying to replace the string below with whitespaces using javascript
function replaceString() { var str = "ABC**EFG"; return str.replace(/\*/g, " "); } I received the result as ABC EFG but I expect the result to come with two whitespace. I also tried the same thing using php str.replace but still get the same result.
Is there any other methods i can used to replace the individual asterisk with whitespace??
P/S: The return string will be used as part of the sql query
[UPDATE]
I ended up return the string without any replacement to sql, then I use sql replace function to perform replacement in the query.
and not " " because in html many whitespaces is only one whitespace instead.