views:

247

answers:

2

Hi, I want to replace all the occurances of a period '.' in a JavaScript string For example, I have

var mystring = 'okay.this.is.a.string';

I want to get -> okay this is a string

so far I tried

mystring.replace(/./g,' ')

but this ends up with all the string replaced to spaces. Any idea how to resolve this?

+8  A: 

Almost ...

mystring.replace(/\./g,' ')

Regards.

aefxx
A: 

thans for help :)

Semih TUĞRUL