Studio 2011: search/replace for adapting number format
Thread poster: DrAT2

DrAT2  Identity Verified
Switzerland
Local time: 14:07
English to French
+ ...
Apr 23, 2012

Hello All,

I have a big project with many numbers that need adapting in the matter of thousands separation, from german usage (nn.nnn) to french (nn nnn). Studio adapted the format of some numbers, but not all; most were propagated in the wrong way and I overlooked this during translation.

So know, faced with thousands of numbers to modify, I can only say: please tell me I can do this with a find/replace operation...

Sorry if this is covered elsewhere, I did not find a solution to this problem in my searches.

Thanks!
Titus


Direct link Reply with quote
 

István Hirsch  Identity Verified
Local time: 14:07
English to Hungarian
With Studio 2009 Apr 23, 2012

This will change a period followed by three digits to space (nn.nnn to nn nnn). If a period is used in the target text as a decimal separator too, the problem is more complex.

To perform replacement, in Editor View go to Edit/Replace, check "Use”, select „Regular Expressions” and

Find:

.(?=[0-9]{3})

Replace with:

a space ("press spacebar once").

If the segment where the replacement took place had been „Translated”, status changes to „Draft”.

If you want to change the status of the „replaced” segments to „Translated” again in a batch process, before performing the above replacements, filter the target segments with the expression above (putting the expression in the „Containing" box of the filter) - this collects the segments to change - do the replacements above, and follow the batch process of changing the status.


Direct link Reply with quote
 

DrAT2  Identity Verified
Switzerland
Local time: 14:07
English to French
+ ...
TOPIC STARTER
Need some more precisions.. Apr 23, 2012

Dear István,

Thank you for that tip.
I tried a simple research with your operation, but it as far as I can tell, it returns any punctuation sign or other character followed by three digits.
e.g. it will highlight " 2012", "2012", "-2012", etc.

I just tried this expression:
(?=[0-9]{2}).(?=[0-9]{3})
thinking "2 digits, period, three digits".
Didn't work - it did reduce results, now I do not get " 2012" anymore, the space is not included anymore.

Any further advice is warmly welcome.

Thanks,
Titus

-EDIT-
Tried with this expression:
\.([0-9]{3})
seems to return the ".nnn"
And this one:
([0-9]{1,2})\.([0-9]{3})
returns the "nn.nnn"

Will try to batch treat with this after a few tests.

[Edited at 2012-04-23 14:11 GMT]

-EDIT-
The finding is OK, but replacing gives me
for "3.000" -- "3 ([0-9]{3})".

[Edited at 2012-04-23 14:15 GMT]


Direct link Reply with quote
 

DrAT2  Identity Verified
Switzerland
Local time: 14:07
English to French
+ ...
TOPIC STARTER
Solution found... Apr 23, 2012

Find
"\.(?=[0-9]{3})"

Replace with
" " (press spacebar once"

Done deal.
Thanks István.


Direct link Reply with quote
 

István Hirsch  Identity Verified
Local time: 14:07
English to Hungarian
Sorry, Apr 23, 2012

I forgot the backslash, it should work now:

\.(?=[0-9]{3})

let me know if it does not.

[Módosítva: 2012-04-23 14:45 GMT]


Direct link Reply with quote
 
jimshanks
Local time: 13:07
Dutch to English
Still not worked out regular expressions. Jun 20, 2012

Hi all,
I have been trying to work out how I can take an expression like 2000kg and replace it with 2000 kg. No matter what I try I cannot find a regular expression that will insert a space between the number and the abbreviation for kilogram. Can anyone help? It will save me hours as I have many many segments to amend.
Thanks
Jim


Direct link Reply with quote
 

István Hirsch  Identity Verified
Local time: 14:07
English to Hungarian
This works in Studio 2009 Jun 20, 2012

If you are sure that there is not any word in your text that ends in kg, just

Find:
kg_

Replace with:
_kg_
(note the spaces).

If you are not, check it; check "Use”checkbox, select „Regular Expressions” and

Find:
[a-z]kg
to find words that end in kg. Convert them temporarily for the time of the replacement step.


Direct link Reply with quote
 
jimshanks
Local time: 13:07
Dutch to English
That's great! Jun 20, 2012

Hi Istvan,
many thanks indeed! You really are on the ball with search and replace - that little bit of latteral thinking that I cannot seem to get my head around!
It is currently working its way through the search and replaces (one minor problem is that some are already in the right format 2000 kg so it inserts an extra space, no worry though I just then run a second search and replace __kg and replace it with _kg). Seems to be working fine!
Thanks again
Jim


Direct link Reply with quote
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Studio 2011: search/replace for adapting number format

Advanced search







SDL MultiTerm 2017
Guarantee a unified, consistent and high-quality translation with terminology software by the industry leaders.

SDL MultiTerm 2017 allows translators to create one central location to store and manage multilingual terminology, and with SDL MultiTerm Extract 2017 you can automatically create term lists from your existing documentation to save time.

More info »
memoQ translator pro
Kilgray's memoQ is the world's fastest developing integrated localization & translation environment rendering you more productive and efficient.

With our advanced file filters, unlimited language and advanced file support, memoQ translator pro has been designed for translators and reviewers who work on their own, with other translators or in team-based translation projects.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search