Wildcards in Word Iniziatore argomento: Emma Goldsmith
|
Emma Goldsmith Spagna Local time: 03:40 Membro (2004) Da Spagnolo a Inglese
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? | | |
Rolf Keller Germania Local time: 03:40 Da Inglese a Tedesco 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 | | |
wotswot Francia Local time: 03:40 Membro (2011) Da Francese a Inglese 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... See more 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). ▲ Collapse | | |
Emma Goldsmith Spagna Local time: 03:40 Membro (2004) Da Spagnolo a Inglese AVVIO ARGOMENTO
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] | |
|
|
wotswot Francia Local time: 03:40 Membro (2011) Da Francese a Inglese
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? | | |
Rolf Keller Germania Local time: 03:40 Da Inglese a Tedesco
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. | | |
Emma Goldsmith Spagna Local time: 03:40 Membro (2004) Da Spagnolo a Inglese AVVIO ARGOMENTO 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 t... See more 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] ▲ Collapse | | |
Oscar Martin Spagna Local time: 03:40 Da Inglese a Spagnolo + ... 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 | |
|
|
Emma Goldsmith Spagna Local time: 03:40 Membro (2004) Da Spagnolo a Inglese AVVIO ARGOMENTO 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 | | |
wotswot Francia Local time: 03:40 Membro (2011) Da Francese a Inglese
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? | | |
PAS Local time: 03:40 Da Polacco a Inglese + ... 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. | | |