Copy link to clipboard
Copied
Indesign GREP newbie here. I'm receiving text of times that requires reformating. How would I format time ranges using a GREP code to omit the first "am" or "pm" from any time ranges that have "am" or "pm" twice in the same time range? Also, I'm trying to omit the ":00" from all time ranges. Is there a simple way of eliminating that in the same GREP?
For Example:
This is what’s provided:
• 9:15am-10:00am
• 1:00pm-3:30pm
• 11:30am-12:30pm
• 9:00am-1:00pm
This is what I’m aiming for:
• 9:15-10am
• 1-3:30pm
• 11:30am-12:30pm
• 9am-1pm
Few different GREP queries.
First consolidate the ams and pms:
Find:
(\d{2})(am)-((\d|:){4,5})(am)
Change:
$1-$3$5
Do the same for pm
Then to remove the :00, find:
(\d)(:00)
and replace with:
$1
You achieve it with only a single query. Leave change to empty.
([ap]m)(?=-.+\1)|:00
Copy link to clipboard
Copied
Hi David,
is every of the lines a single paragraph?
And how is the bullet done? Auto bullet list or is it typed?
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Few different GREP queries.
First consolidate the ams and pms:
Find:
(\d{2})(am)-((\d|:){4,5})(am)
Change:
$1-$3$5
Do the same for pm
Then to remove the :00, find:
(\d)(:00)
and replace with:
$1
Copy link to clipboard
Copied
Thank you very much! Happy holidays.
Copy link to clipboard
Copied
You achieve it with only a single query. Leave change to empty.
([ap]m)(?=-.+\1)|:00