Search/Replace Variable Prices
Learn / Forums / General InDesign Topics / Search/Replace Variable Prices
- This topic has 3 replies, 2 voices, and was last updated 10 years, 8 months ago by Justin Sligh.
-
AuthorPosts
-
-
July 31, 2013 at 9:50 am #64611Christophe UllensMember
Hi everybody,
I’m requesting your help, because I have some troubles to find an productive solution and i’m sure i’m missing some knowledges to have it done.
So, I have an international magazine with a bunch of price points like this;
US?$65
CA?$80
EU €70For the publication of the magazine in Quebec, I need to change the sign of currency by place like this:
65$ US?
80$ CA?
70€ EUDoes anyone know if there is an easy way to do it by search and replace, by changing the order but keeping the digit prices?
Thx for your help
-
July 31, 2013 at 11:46 am #64616Justin SlighMember
Christophe,
Assuming a few things:
1. Currencies are whole numbers.
2. There are no spaces after the “?” in your international version (In your example, US?$65 CA?$80 have no space but EU €70 does. Was this intentional or did the forum adjust your post automatically.)Grep Find:
(US\?|CA\?|EU )(\$|€)(\d+)Change to:
$3$2 $1We are asking InDesign to:
1. Find “US?”, “CA?”, or “EU ” and set as variable “$1”; find a “$” or “€” and set as variable “$2”; and find one or more consecutive digits and set as variable “$3”
2. Paste variable “$3” followed by “$2″ followed by a space and then” $1″() Items within parentheses are sub-expressions and can be used as variables within the Change to. If you find (Red)(Blue)(Green) $1 is “Red” $2 is “Blue” and $3 is “Green”.
? and $ are functions used by grep so to look for actual characters, you need to escape them using a backslash “\”
\d indicates a digit
+ indicates one or more of the previous.-
July 31, 2013 at 1:15 pm #64617Christophe UllensMember
Hi Justin,
thx this is amazing!!! The question marks that you was asking about should supposed to be a thin spaces.
So it should be:
US?$65 CA?$80 UK?£70 (the “?” is actually a thin space)replaced by:
65$?US 80$?CA 70£?UK (the “?” is actually a thin space)Sorry for that mistake
I tried:
(US~<|CA~<|UK~< )(\$|£)(\d+)But it didn’t really work…
-
-
July 31, 2013 at 1:33 pm #64618Justin SlighMember
Christophe,
Do you have a mix of different types of whitespace between the original text?
You can use:
(US|CA|EU)\s(\$|€)(\d+)
$3$2~<$1
This will find the country code than any whitespace character followed by the currency symbol and then digit(s).
The replace string adds a thin space regardless of the type of whitespace within the find.
-
-
AuthorPosts
- You must be logged in to reply to this topic.