Wildcards in Word
Thread poster: Emma Goldsmith

Emma Goldsmith  Identity Verified
Spain
Local time: 03:59
Member (2010)
Spanish to English
Jun 25, 2012

I'm stuck (again) trying to figure out how to use wildcards to replace commas with periods in this sort of string in Word:
5,34E-03
-6,32E-03

The comma is always followed by two digits and E, so in the find box I have put:
,[0-9]{2}E
but I'm stuck on the replace box. I've tried
.\1
but it doesn't work.

Can anyone help me, please?


Direct link Reply with quote
 

Rolf Keller
Germany
Local time: 03:59
English to German
Regular expressions in Word Jun 25, 2012

Emma Goldsmith wrote:

I'm stuck (again) trying to figure out how to use wildcards to replace commas with periods in this sort of string in Word:
5,34E-03
-6,32E-03


You have to use () in order to build two groups.
Search: (,)([0-9]{2}E)
Replace: .\2


Direct link Reply with quote
 
wotswot  Identity Verified
France
Local time: 03:59
Member (2011)
French to English
Wildcard syntax Jun 25, 2012

Find what: ,([0-9]{2})E
Replace with: .\1E

The \1 in the Replace refers to the first grouped expression in the Find (i.e. the expression surrounded by (round) brackets).
You can have as many grouped expressions as you like, for instance:

Find what: ([0-9]{2}),([0-9]{2}) %
Replace with: \1.\2%

should replace all French-format percentages with English-format ones.

The main thing to bear in mind is that GROUPS are in brackets in the Find and referenced sequentially by \n in the Replace (where 'n' is the nth bracketed expression).


Direct link Reply with quote
 

Emma Goldsmith  Identity Verified
Spain
Local time: 03:59
Member (2010)
Spanish to English
TOPIC STARTER
'fraid not Jun 25, 2012

Thanks for your ideas, Rolf and wotswot. I'd completely forgotten about building groups with brackets.
However, neither suggestion seems to work. In both cases the comma disappears, but the period is sent to the end of the string.
i.e. 5,34E-03 becomes 534.E-03 (wotswot) and 534E.-03 (Rolf)

Any more ideas?

[Edited at 2012-06-25 18:16 GMT]


Direct link Reply with quote
 
wotswot  Identity Verified
France
Local time: 03:59
Member (2011)
French to English
@Emma Jun 26, 2012

Very odd. It works fine with me, in Word 2010 and 2003, what's your version?
Try ([0-9),([0-9]{2})E in Find and \1.\2E in Replace. Does that work?
Silly question no doubt, but are you sure you have 'Use wildcards' ticked and only that?


Direct link Reply with quote
 

Rolf Keller
Germany
Local time: 03:59
English to German
@Emma Jun 26, 2012

Emma Goldsmith wrote:

neither suggestion seems to work. In both cases the comma disappears, but the period is sent to the end of the string.


Strange. My proposal works for me.


Direct link Reply with quote
 

Emma Goldsmith  Identity Verified
Spain
Local time: 03:59
Member (2010)
Spanish to English
TOPIC STARTER
track changes Jun 26, 2012

I tried your new suggestion, wotswot, and that didn't work either, so I continued to experiment, and I've just discovered all these options do work but not for text that is hidden when track changes is on.

They work when track changes is on, and the text is unhidden,
They work when track changes is off, and the text is hidden,
But they don't work when TC and hidden text is used together

So thank you, wotswot and Rolf. All of your ideas worked, but I will have to remove the hidden text format to do the F&R and then put it back in again afterwards.

(Using Word 2010 prof 32-bit, by the way).

Thanks again for your help,
Emma

Edited to add: Now the hidden text doesn't seem to be related. But I still have to take off tracked changes.

[Edited at 2012-06-26 10:31 GMT]


Direct link Reply with quote
 

Oscar Martin
Spain
Local time: 03:59
English to Spanish
+ ...
Wildcards in Word Jun 26, 2012

Hi Emma,

This search works fine. Activate the wildcards checkbox.

Search: ([0-9]),([0-9]@E)
Replace with: \1.\2

It will replace all numbers (with an E) containing comma with period.

Regards,

Oscar


Direct link Reply with quote
 

Emma Goldsmith  Identity Verified
Spain
Local time: 03:59
Member (2010)
Spanish to English
TOPIC STARTER
track changes again Jun 27, 2012

Oscar Martin wrote:
Search: ([0-9]),([0-9]@E)
Replace with: \1.\2


Hi Oscar,
Thanks for your suggestion. It works perfectly until I enable track changes and then, mysteriously 5,34E-03 gets replaced as follows:
534E.-03
Still, I am now disabling track changes as a workaround, so the issue is solved.

Does anyone know if it is normal for wildcards not to work with track changes?
Thanks,
Emma


Direct link Reply with quote
 
wotswot  Identity Verified
France
Local time: 03:59
Member (2011)
French to English
@Emma Jun 27, 2012

I find quite a few things don't work as expected when TC is on (spell-check not ignoring deletions, etc.). Anyway, translating with TC on is always messy. Do you really have to?

Direct link Reply with quote
 

PAS  Identity Verified
Local time: 03:59
English to Polish
+ ...
Q&D solution (only if all numbers are close together) Jun 27, 2012

If the numbers are all in a table, all you need to do is mark the column(s) containing the numbers, click ctrl+h (search & replace) replace the comma with the dot, click "replace all" and then click "no", when Word asks if to continue in the rest of the document.

Another Q&D solution is to replace all ,1 with .1 ,2 with .2 all the way up to 9.
It ain't pretty, but it works.


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 »

Wildcards in Word

Advanced search






PerfectIt consistency checker
Faster Checking, Greater Accuracy

PerfectIt helps deliver error-free documents. It improves consistency, ensures quality and helps to enforce style guides. It’s a powerful tool for pro users, and comes with the assurance of a 30-day money back guarantee.

More info »
BaccS – Business Accounting Software
Modern desktop project management for freelance translators

BaccS makes it easy for translators to manage their projects, schedule tasks, create invoices, and view highly customizable reports. User-friendly, ProZ.com integration, community-driven development – a few reasons BaccS is trusted by translators!

More info »



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