[Solved] Find unformated dates in a document?

Discuss the word processor
Post Reply
Kaze
Posts: 7
Joined: Tue Nov 14, 2023 6:42 am

[Solved] Find unformated dates in a document?

Post by Kaze »

Is there a way for Open Office to recognize and find unformatted dates? I have hundreds of pages of journal entries, each with a date and a heading. Nothing is formatted. If possible, I'd like to select all the dates and put them in italics (or whatever, this is an example). Dates are sometimes written like "Aug 4, 2007" or similar.

Obviously I can use "Find" to select every instance of "September" or "2010" and put them in italics, but that won't work with the numbers, given that numbers appear all over the place in my journal.

I'm not an Open Office Writer enthusiast, I'm just a guy with hundreds of pages of text. If you have advice, please keep in mind that I don't know a lot of the lingo that a "super user" might be used to.
Last edited by Kaze on Sun Nov 26, 2023 2:26 am, edited 1 time in total.
Apache Open Office 4.1.14. Windows 10
JeJe
Volunteer
Posts: 2843
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer: Find unformated dates in a document?

Post by JeJe »

With the Find dialog tick regular expressions. First search result details for Date formats are here but there may be better ones:

https://www.freecodecamp.org/news/regex ... ing-dates/
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2843
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer: Find unformated dates in a document?

Post by JeJe »

For your example the following would work for all August dates with that pattern.
Aug \d, \d{4}
Aug find Aug
\d with any following digit
, and a comma and a space
\d{4} and any 4 digits


Edit: If you don't know about Character styles for Writer, look that up. You could create one for your dates and that would make changing them all at once to a different format easy.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2843
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer: Find unformated dates in a document?

Post by JeJe »

To do a search for all the months at once with your pattern it would be
(Jan|Feb|Mar|Apr|May|Jun|July|Aug|Sep|Oct|Nov|Dec) \d, \d{4}
(Jan|Feb|Mar|Apr|May|Jun|July|Aug|Sep|Oct|Nov|Dec) means match any of those items separated by |

You should be able to make you own simple adaptation to find whatever format your dates are in.

Edit: missed out May!
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Kaze
Posts: 7
Joined: Tue Nov 14, 2023 6:42 am

Re: Writer: Find unformated dates in a document?

Post by Kaze »

SWEET! I've played with your suggestion a bit and already enjoying great success.
I appreciate your help JeJe. Take care :)
Apache Open Office 4.1.14. Windows 10
Post Reply