I'm trying to work out what regular expression I would need to take a value and replace spaces with a dash (in Javascript)?
So say if I had North America, it would return me North-America ?
Can I do something like var foo = bar.replace(' ', '-')
?
It's better to use:
var string = "find this and find that".replace(/find/g, "found");
to replace all occurrences.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With