0

I am using this regular expression in Notepad++ to find numbers which need a thousand separator:

("value": "\d{1,3}|\G\d{3})(?=(?:\d{3})+(?!\d))

It's working fine, but I need to replace the string with the very same string with an added period (dot) at the end (I'm in Italy and we use a dot as thousands separator).

I'm not an expert on regular expressions (I copied and modified the one above to suit my needs) so I didn't get any results. The find works, the replace doesn't (for instance \1\.).

Can somebody help me? Thanks.

Ibrahim Najjar
  • 19,178
  • 4
  • 69
  • 95
  • 1
    Substitute period for comma: http://stackoverflow.com/questions/721304/insert-commas-into-number-string – Jack Nov 05 '13 at 15:56
  • There are no commas actually. It's just numbers without separators. EDIT: oh I see what you mean now. But it doesn't work, I read somewhere $ doesn't work with Notepad++. I already tried "$1," in the replace field, but to no avail. – Fuzzee Lowgeek Nov 05 '13 at 15:57
  • Do you want to add the thousands separator or you want to append the dot to the end of the entire match ? In other words, can you show some sample input and the expected output ? – Ibrahim Najjar Nov 05 '13 at 16:00
  • I just need to add a dot at the end of the entire match, because the matches are already fine. – Fuzzee Lowgeek Nov 05 '13 at 16:06

1 Answers1

1

You can use the following as a replacement string:

$1.

I have tested it and it is working pretty well, you just need to make sure the file is saved to disk at least once before you try to make any replacements, otherwise it won't work.

Ibrahim Najjar
  • 19,178
  • 4
  • 69
  • 95
  • Don't know why, but it's not working for me. I had already tried that if I'm not mistaken... This is a part of my file: "BW": { "value": "2030738", "href" : "#", "tooltip": { "content": "Botswana<\/span>
    Population : 2030738" } }, "BR": { "value": "196655014", "href" : "#", "tooltip": { "content": "Brazil<\/span>
    Population : 196655014" } },
    – Fuzzee Lowgeek Nov 05 '13 at 16:23
  • @user1770784 I almost ready to bet that you have a very old Notepad++ version. Please update to latest version 6.5 and recheck Sniffer's answer! – psxls Nov 05 '13 at 16:28
  • Sorry, errata corrige. It worked great with Replace All, the single Replace command wouldn't work. Go figure. – Fuzzee Lowgeek Nov 05 '13 at 16:31