PDA

View Full Version : Solved: Help needed in using"Find and replace" on a particular format of text



Kumarcoolz
05-14-2013, 06:15 AM
HI Guys

i am into technical authoring where i have to process data in a predefined fashion. i have a document which has dimensions written in the following format

eg: (0.001 mm) or (0.01 mm) or (1 mm) but the correct format required is (0,001mm) or (0,01mm) or (1mm)

i tried special function of "find and replace" (Ctrl+H)
FIND WHAT: ^#.^#^#^# mm
but dont know how to use the REPLACE WITH as the field do not have same options "find what" field

Do help me with suggestions or solutions (VBA or any other means) on how to go over this manual nightmare, as i have over 50 such files and each file will have 100 such dimensions.: pray2:

macropod
05-14-2013, 09:56 PM
You don't need a macro for this - you can do it with a wildcard Find/Replace, where:
Find = ([0-9]).([0-9]{1,}mm)
Replace = \1,\2

Note: If you get an error message telling you the Find expression is invalid, use:
Find = ([0-9]).([0-9]{1;}mm)

Kumarcoolz
05-15-2013, 02:04 AM
You don't need a macro for this - you can do it with a wildcard Find/Replace, where:
Find = ([0-9]).([0-9]{1,}mm)
Replace = \1,\2

Note: If you get an error message telling you the Find expression is invalid, use:
Find = ([0-9]).([0-9]{1;}mm)


Thanks alot Macropod :bow: you made my job so easy

your code did not replace the space between the number and mm

so i changed it to
Find = ([0-9]).([0-9]{1,}[ ](mm)
Replace = \1,\2\3

and it works gr8 now:). couldnt have done it without you. i may have to do similar tasks in the near future and i dont want to disturb the forum on petty issues like these. it would be gr8 if you suggest links or reference were i can understand wildcards better...... thanks again Macropod:beerchug:

macropod
05-15-2013, 02:07 AM
See: http://word.mvps.org/FAQs/General/UsingWildcards.htm, http://www.gmayor.com/replace_using_wildcards.htm, http://office.microsoft.com/en-us/help/add-power-to-word-searches-with-regular-expressions-HA001087305.aspx