Find/Change (Multiple Date Changes in one Find) - InDesign CS5 or earlier

Primary tabs

7 posts / 0 new
Last post
Andrew Sipe's picture
Offline
Joined: 25 Apr 2005 - 10:44am
Find/Change (Multiple Date Changes in one Find) - InDesign CS5 or earlier
0

ID geniuses, got a question for your gigantic brains.

This may or may not be an easy one...

I doing a lot of production work now and I'd like to create a Find/Change or a GREP search that will allow me to change multiple dates at once.

the format changes from file to file and usually follows these 4 formats and its also possible that all 4 formats could be used in one document.

XX/XX/XX (8 characters)

XX/XX/10 (8 characters)

XX/XX/2010 (10 characters)

9/26/10 - wrong date in-place. (6 – 8 characters depending on the month)

Instead of having 4 different searches, is it possible to do one search that look for any/all of these text formats and change them at once?

Thanks!

Andrew Sipe's picture
Offline
Joined: 25 Apr 2005 - 10:44am
0

Well of course, as soon as I post this, I get a response from another site.

Of course GREP comes to the rescue. Enter this in your search field:

\b((XX|\d{1,2})/){2}(XX|\d{2,4})\b

and it'll find any of your examples. Wot Doth This All Mean?

\b a Word break -- there must not be a word character +before+ this entire expression. This means it'll ignore "XXX/XX/XX".
( repeat group -- see below
( XX | \d{1,2} ) Either "XX" (exactly) or "a digit, 1 or 2". This means it'll ignore "XXX/XX/XX" (three exes), pick up "1/2/3" (one digit), ignore "123/123/123" (three digits)
/ A slash. Nothing special, except ...
) .. since this is the end of the repeat group ...
{2} ... we want twice the sequence "XX/" (or "digit/"), to match "XX/XX/" and every possible combo with digits as well.
( oh yet another group. That's because ...
XX .. this literal text ...
| ... OR ... (hold on, I'm gettin' there)
\d{2,4} .. two to four digits should be matched ..
) .. in this entire group.
\b Phew! A Word break to prevent it matching "12/34/5678*9*"

Tiffany Wardle's picture
Offline
Joined: 13 Jul 2001 - 11:00am
0

Thanks for following up with your answer. This sort of search is helpful for sure.

Theunis de Jong's picture
Offline
Joined: 22 Apr 2008 - 5:06pm
0

Ms. Tiff (like your new avatar, by the way!), if you have any GREP question at all, just post it into Adobe's own InDesign forum, or in David Blatner's InDesignSecrets forum.

I'm very partial to InDesign's GREP, always on the look-out for seemingly impossible things to figger out :-)

(Funny Commenting Explanation is an option, when I'm in the Mood.)

Tiffany Wardle's picture
Offline
Joined: 13 Jul 2001 - 11:00am
0

Yes, those forums are helpful too. :)

(by the way—and I know this will sound pompous—but I prefer Tiffany to Tiff.)

Andrew Sipe's picture
Offline
Joined: 25 Apr 2005 - 10:44am
0

Jong, ah! Thanks for the answer (sorry I didn't credit you as the answerer here). Wasn't aware you were a Typophile too.

Matthew Butterick's picture
Joined: 28 Jul 2009 - 3:14pm
0

Type weenies should also investigate grep styles in inDesign.