Skip to main content
Known Participant
November 10, 2017
Answered

Script for moving $ to end of numbers

  • November 10, 2017
  • 3 replies
  • 888 views

I have an english indesign file that was translated to french.  The last thing to be changed are the dollar values.  In english they appear like this $1,200 and in french it needs to have a space followed by the dollar sign at the end of the number and with a space instead of a comma like this 1 200 $

There are hundreds of numbers so I am trying to figure out a way to use the find/replace feature but I am struggling.  Any advice would be greatly appreciated.

Catharine

This topic has been closed for replies.
Correct answer uniqued_tol

Find: (^\$)(\d+)(,)(\d{3})\b Chage:$2 $4 $1

3 replies

Obi-wan Kenobi
Legend
November 11, 2017

Supposing you could have 1 billion of dollars or just 1 dollar in your pocket, you'll need 2 regex to fix it!

1/

Find:  (\$)([\d,]*\d)

Replace by:  $2~s$1

2/

Find:  \d\K,(?=\d)

Replace by:  ~<

(^/) 

uniqued_tol
uniqued_tolCorrect answer
Inspiring
November 10, 2017

Find: (^\$)(\d+)(,)(\d{3})\b Chage:$2 $4 $1

Obi-wan Kenobi
Legend
November 10, 2017

Hi,

Nobody said it was a beginning of para.

A no-break (or thin space) before $ could be cool.

Idem as thousand separator.

Everybody suppose we'll never have more than 999,999!

Try:  $1,000,000,001

(^/) 

yusuke.s
Inspiring
November 11, 2017

Hi all.

How is this expression?

find: \$ *(([1-9]{1,3}\,?([0-9]{1,3}\,?)*)+)

change: $1 $

However, this does not take decimal into consideration.

Regards,

Yusuke.

Yusuke S.
Anantha Prabu G
Legend
November 10, 2017

Hi,

Try this..

Find: (\d+) (\d+) (\$)

Replace: $1,$2$3

Thanks,

Prabu G

Design smarter, faster, and bolder with InDesign scripting.