Skip to main content
Participating Frequently
December 28, 2022
Answered

Find and Replace Price English to French

  • December 28, 2022
  • 3 replies
  • 750 views

Hi All

 

I have a Catalogue that I need to create in French as well - previously we went through manually and changed all the price fromatting. But I know there is a way using GREP and variables to automate this.

 

English Pricing format: $39.99 CA
French Pricing format: 52,50 $CA

 

thanks for your help

This topic has been closed for replies.
Correct answer Jeffrey_Smith

Search: ([$])(\d+).(\d+) (\u\u)

Replace: $2,$3 $1$4

3 replies

Community Expert
December 28, 2022

Are you converting the currency as well as the format? If so, that may require a script instead of a grep.

Participating Frequently
December 28, 2022

no, just the format, thanks

Community Expert
December 28, 2022

\$ finds a dollar sign and distinguish it from grep code, as seen in the replace ($1, etc.) As you can see there are various expressions that ultimately can have the same results. I used [$] with same result.

\d+ finds multiple digits.

Expressions within () treats this as a group that can be moved within the replace.

\u finds capitalized letters.

$1 is the first found group, $2 is the second found group.

 

Look here for more information on GREP

 

 

Jeffrey_SmithCommunity ExpertCorrect answer
Community Expert
December 28, 2022

Search: ([$])(\d+).(\d+) (\u\u)

Replace: $2,$3 $1$4

Participating Frequently
December 28, 2022

Same issue as above, it's not finding any instances of ([$])(\d+).(\d+) (\u\u)

jmlevy
Community Expert
Community Expert
December 28, 2022

Find what: 

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

 

Replace by: 

$2,$3~S$1

 

Note that the ~S means non-breaking space.

Participating Frequently
December 28, 2022

thank you

 

could you explain this a little? it's it's saying it can't find any instances of (\$)(\d+)\.(\d+)

jmlevy
Community Expert
Community Expert
December 28, 2022

Are you sure that you are in the GREP tab of the search and replace window? Not the text tab?

 

(\$) Dollar sign

(\d+) one or more digits

\. a dot

(\d+) one or more digits

 

$2 what has been found inside the second parenthesis

, a comma

$3 what has been found inside the third parenthesis

~S a non-breaking space

$1 what has been found inside the first parenthesis