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

Question

Question

Regular expression for address seperating

asked on March 29, 2021

I am using Quick Fields to OCR a field on a document. The values are usually like so:

Hartford, CT 06120

OCR Token: %(Client's  City, State & Zip)

I got the Zip working correctly but need to insert a regular expression for the other two fields. Any suggestions?

  • City (Should just be city)
  • State (Should just be two letter state)
  • Zip %(Client's  City, State & Zip#<\d\d\d\d\d>#) (Works fine)
0 0

Answer

SELECTED ANSWER
replied on March 29, 2021

Here's some that I use in a couple places in Workflow, I'm sure it'll probably work in QF too.

These all assume the format is one of two options (the | symbol means OR):

  1. City followed by comma, space, 2 letter state, space, and 5 digit zip.
  2. City followed by comma, space, 2 letter state, space, and 10 digit zip (zip+4 with hyphen).

 

City:     (.*)\,\s\w{2}\s\d{5}|(.*)\,\s\w{2}\s\d{5}\-\d{4}

State:     .*\,\s(\w{2})\s\d{5}|.*\,\s(\w{2})\s\d{5}\-\d{4}

Zip (if you only ever want the 5 digit):     .*\,\s\w{2}\s(\d{5})|.*\,\s\w{2}\s(\d{5})\-\d{4}

Zip (either the 5 digit or the 10 digit):     .*\,\s\w{2}\s(\d{5})|.*\,\s\w{2}\s(\d{5}\-\d{4})

 

These all use the same structure, it is just the ( and ) symbols that indicate what part you want to retrieve.

2 0
replied on March 29, 2021

This worked perfectly!!!! Thanks for your help!!!!

1 0
replied on March 29, 2021

Glad to help. smiley

0 0

Replies

replied on April 1, 2021 Show version history

I have a quick follow up question. My session is not finding values via the OCR (that's ok because some of the values are in handwriting or the fields are empty).

 

However, when I go to store the documents, I get the token error (red underline) and documents will not store. Is there a setting that I don't have set to store them anyway with the blank values? 

QF Error.PNG
QF Error.PNG (65.36 KB)
0 0
replied on April 1, 2021

If you use the Pattern Matching process instead of inline regular expressions, the token will generate a blank value when it does not find a match (or you can, optionally, return the input value).

0 0
replied on April 1, 2021

I am a little rusty w/ QF. Is this from the Page Processing section? 

0 0
replied on April 1, 2021

Yes.

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

Sign in to reply to this post.