Need an update for the workflow. My previous example provided lines with the dates in them. How can I go about extorting the date if there is a bunch of text between the lines?
1/10 - May 14, 2019
Bunch of text. Bunch of text
Bunch of text
Bunch of text
Bunch of text
Bunch of text
2/10 - May 24, 2019
Bunch of text. Bunch of text. Bunch of text.
Bunch of text
MACRO: Extract Dates from Multi-Line Text [Example]
**Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9d9 on macOS 10.14.5 (Mojave))
#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/4/6/46526ce501b4d6353915bebeb1c2f424ae477802.kmmacros">Extract Dates from Multi-Line Text [Example].kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**
---
![image|508x1228](upload://7ZPJxXJ4rd7uVdUFMBzaFjJ1ooR.png)
[details=Full-Sized-Image]
<img src="/uploads/default/original/3X/3/a/3aed78cd98a72747b857c0b92fc8946fc0b16cf5.png" width="508" height="1228">
[/details]
Hey Chris, one issue that might occur with Data Detectors looking at all text in the source is if some of the "bunch of text" contained text that could be construed as a date, like say "8/13", or even an actual date when then only dates you want are in the "header rows" as defined by the RegEx.
Yep, that's another thing you'd have to do.
May I suggest that you allow for setting of date format in KM variable, using the ICU format, and then if that variable is empty/missing, just output in a standard format (I'd suggest the ISO format).
Having said all that, I really like the ASObjC Data Detectors, and use it often.