Find Replace dates dd/mm/yy from d/m/yy

J

JohnJ

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?
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Jay Freedman

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
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Graham said:
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?
 
G

Graham Mayor

That's what comes with testing on too few date samples ;) :(

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Jay said:
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 said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top