3
Hello everybody all right? I’m cracking my head on the following question:
I have a string set:
var teste = blabla 555.. 999
I have double white space between the digits and did the regex:
var str = teste.replace(/\s{2,}/g, '.');
The problem that it will replace the two spaces by only one point ".", I wanted to make a loop with the following algorithm:
- I found 2 blank spaces
- Replaced by two points "."
- It would look like this: test = Blabla 555.... 999
Some light, path of stones?
Try to do
/\s{1}/g
, and replace each space by a point, using a while.– ptkato