I would like to remove spaces and hyphens from the given string.
var string = "john-doe alejnadro"; var new_string = string.replace(/-\s/g,"")
Doesn't work, but this next line works for me:
var new_string = string.replace(/-/g,"").replace(/ /g, "")
How do I do this at a time?
javascript regex
Alon
source share