0

I'm trying to match the second dot in a number to replace it later with a white space in my 'find and replace' function in Aptana.

I tried a lot of expressions, none of them worked for me.

For example I take the number:

48.454.714 (I want to replace the dot between 454 and 714)

halfer
  • 19,824
  • 17
  • 99
  • 186
Maximilian Lindsey
  • 809
  • 4
  • 18
  • 35

2 Answers2

2

Try this regex:

(\d{3})\.(\d{3})

and replace the first and second capturing group \1 \2

as mentioned by FiveO, you might want to match other numbers of digits too. E.g. one to 3 digits: \d{1,3} or any number of digits: \d+

morja
  • 8,297
  • 2
  • 39
  • 59
0

Try with following regex:

\d+\.\d+(\.)\d+

And replace it with white space.

hsz
  • 148,279
  • 62
  • 259
  • 315
  • 1
    Thanks for the quick answer! Now I have a follow up question: How do you replace only a group? – Maximilian Lindsey Sep 12 '12 at 11:50
  • @dj_rmb Read a bit about regex in JavaScript, you'll quickly have your answer ;) – sp00m Sep 12 '12 at 12:04
  • @sp00m I assume you know the answer to my question, and instead of helping me here you give me that... – Maximilian Lindsey Sep 12 '12 at 12:13
  • 1
    @dj_rmb Because you should learn how to search. Google -> javascript regex replace only a group -> [first link](http://stackoverflow.com/questions/1234712/javascript-replace-with-reference-to-matched-group) – sp00m Sep 12 '12 at 12:25