You are viewing limited content. For full access, please sign in.

Question

Question

Regular Expression Date two options neither is working

asked on June 4, 2015

I am trying to populate a metadata field with a meeting date and I see two ways I can get it and neither is working 100% correctly.

The first is in the file name:

File Name Example: City Council Minutes 1989 10 17

Regex: %(Name#"d"##<(\d\d\d\d\s*\d\d?\s*\d\d?)>#)

This works as long as the day is a single digit day for example 2015 01 06 --> 01/06/2015

But it fails on two digit days for example 2015 01 17 --> 20/15/01

 

The other thing I could do is get it from within the document by doing a Zone OCR and Pattern Matching

Here is the OCR Zone

And the Pattern Matching Token

I've tested it with the text that is in the output pane after OCR is done of zone and it works, but when I run the session it is pulling this into the field: MINUTES OF THE REGULAR MEETING OF THE

I'm fine with doing it either way, just whichever will work more consistently!

0 0

Answer

SELECTED ANSWER
replied on June 4, 2015

That's because Windows doesn't know how to interpret the set of numbers that don't match its date format, so it does a best guess at matching it to the machine's date format. It's best if you use pattern matching to break it down into year, month, day and reconstruct it in the field so you control the order.

For the file name, I'd do something like (\d\d\d\d) for the year, \d\d\d\d\s+(\d\d?) for the month and \d\d\d\d\s+\d\d\s+(\d\d?) for the day. Then put %(year)-%(month)-%(day) in the field.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.