• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

insert thousand separators in search and replace?

Community Expert ,
Jan 04, 2018 Jan 04, 2018

Copy link to clipboard

Copied

I have a bunch of numbers looking like this:

1340,10

1032,10

I need to do a search and replace which inserts thousand separator like this:

1.340,10

1.032,10

Can it be done using GREP or some other kind of script which "counts the numbers" and inserts dots where needed?

Best regards

Bjørn


Bjørn Smalbro - FrameMaker.dk
TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 04, 2018 Jan 04, 2018

Copy link to clipboard

Copied

There is this free script which I wrote a while ago: https://www.id-extras.com/script-to-format-long-numbers

I think it should work to do what you want (been a while since I've used it).

If all your numbers are exactly 4 digits, of course, a script isn't necessary, as a fairly simple GREP would work. But if the numbers are of varying length, the script is probably the easiest way to go...

Ariel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 04, 2018 Jan 04, 2018

Copy link to clipboard

Copied

find:(\d{1,2})(\d{3}),(\d{2}) change:$1.$2,$3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 04, 2018 Jan 04, 2018

Copy link to clipboard

Copied

Nice, but won't work obviously for numbers over 99999...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2018 Jan 04, 2018

Copy link to clipboard

Copied

LATEST

Try this...

Find: (\d)(?=(\d\d\d)+\b)

Replace: $1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines