Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
JohnJ[_2_] JohnJ[_2_] is offline
external usenet poster
 
Posts: 6
Default Find Replace dates dd/mm/yy from d/m/yy

Date in the dd/mm/yy format. Table contains 6/3/02 instead of 06/03/02 or 6/3/05 instead of 06/03/05.

I tried:

Find what: ([!0])([1-9]/[0-9][0-9]/0[0-9])

Replace with: \10\2

Use Wildcards

But it does not put the 0 in everywhere. Any ideas please?



  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 79
Default Find Replace dates dd/mm/yy from d/m/yy

If the dates are each alone in the cell of a table and the 0 is missing from
day and month then replace
([1-9]/)([1-9]/[0-9])
with
0\10\2

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





"JohnJ" wrote in message
...

Date in the dd/mm/yy format. Table contains 6/3/02 instead of 06/03/02 or
6/3/05 instead of 06/03/05.
I tried:
Find what: ([!0])([1-9]/[0-9][0-9]/0[0-9])
Replace with: \10\2
Use Wildcards
But it does not put the 0 in everywhere. Any ideas please?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Find Replace dates dd/mm/yy from d/m/yy

Just to clarify what's happening, if a date with a single-digit day is the
first text in a cell, then the sub-expression [!0] in the expression
([!0])([1-9]/[0-9]/0[0-9]) won't match anything. The Find engine won't
consider anything in the preceding cell (if any) to be a candidate for a
match.

Graham, the problem with the expression you suggest is that ([1-9]/) _will_
match the second digit of a two-digit day and it'll insert a zero in the
middle; e.g., the date 11/2/05 will be changed to 101/02/05.

I think this may be a case where a macro is necessary, to do a wildcard
search for the expression [1-9]/[0-9]/0[0-9] and then examine the character
(if any) that precedes the found range to decide whether to insert a zero.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Graham Mayor wrote:
If the dates are each alone in the cell of a table and the 0 is
missing from day and month then replace
([1-9]/)([1-9]/[0-9])
with
0\10\2


Date in the dd/mm/yy format. Table contains 6/3/02 instead of
06/03/02 or 6/3/05 instead of 06/03/05.
I tried:
Find what: ([!0])([1-9]/[0-9][0-9]/0[0-9])
Replace with: \10\2
Use Wildcards
But it does not put the 0 in everywhere. Any ideas please?



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Find Replace dates dd/mm/yy from d/m/yy

That's what comes with testing on too few date samples

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Jay Freedman wrote:
Just to clarify what's happening, if a date with a single-digit day
is the first text in a cell, then the sub-expression [!0] in the
expression ([!0])([1-9]/[0-9]/0[0-9]) won't match anything. The Find
engine won't consider anything in the preceding cell (if any) to be a
candidate for a match.

Graham, the problem with the expression you suggest is that ([1-9]/)
_will_ match the second digit of a two-digit day and it'll insert a
zero in the middle; e.g., the date 11/2/05 will be changed to
101/02/05.
I think this may be a case where a macro is necessary, to do a
wildcard search for the expression [1-9]/[0-9]/0[0-9] and then
examine the character (if any) that precedes the found range to
decide whether to insert a zero.

Graham Mayor wrote:
If the dates are each alone in the cell of a table and the 0 is
missing from day and month then replace
([1-9]/)([1-9]/[0-9])
with
0\10\2


Date in the dd/mm/yy format. Table contains 6/3/02 instead of
06/03/02 or 6/3/05 instead of 06/03/05.
I tried:
Find what: ([!0])([1-9]/[0-9][0-9]/0[0-9])
Replace with: \10\2
Use Wildcards
But it does not put the 0 in everywhere. Any ideas please?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find multiple characters in one find using MSword find/replace Cliff Microsoft Word Help 2 October 29th 06 07:48 PM
Trying to replace words with fields using Find/Replace mbleyle Microsoft Word Help 2 March 29th 06 11:35 PM
Using find and replace or macros to replace page ranges JeremyC Microsoft Word Help 7 February 13th 06 09:20 PM
Find/ Replace is auto-capping the words I want to replace with Graham Mayor Microsoft Word Help 8 January 27th 06 01:39 AM
Find and Replace: delete a line & find a number 10 Janis Anna Microsoft Word Help 3 October 23rd 05 05:53 AM


All times are GMT +1. The time now is 07:33 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"