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

Question

Question

Regex in Quick Fields vs. Quick Fields 8

asked on January 27, 2016

We inherited a situation where we have to migrate a series of Quick Fields sessions from QF 7 to QF 8.01.  (And are working to get to 10, since you are probably thinking that.)  We imported the V7 session, and replaces all of the OCR Zones. So far so good.  Now we have a series of pattern matches, none of which work any longer.  The details are below, but I think my real question is not why they don't work in QF 8.0.1, but how they worked in QF 7.  It seems the 7 interpreter has a lot of non standard elements in it.

 

Here are the expressions and the results.


Migration: Quick Fields 7.2.1 To 8.02.448

 

Zone: Name => First Name (Parse first name out of a zone reading First, MI, Last)

RegEx: {\w}\b\c?\b?\w$

Throws error, Illegal escape character: c. zero or one repetition.

 


Zone: Name =>Last Name (Parse Last name out of a zone reading First, MI, Last)

RegEx: \w\b?\c?\b{\w}


Zone: Name => Middle Initial (Parse middle initial out of a zone reading First, MI, Last)

RegEx: \w{\b?\c?}\b\w

Throws error, Illegal escape character: c. zero or one repetition.

 


Zone:  Check Date

RegEx: \z\n\n{\d\d?.\d\d?.\d\d\d\d}

No error, does not parse 6/22/2001


Zone: Check Number

RegEx: {\z}

No formatting error, does not parse 93461

 

Zone: Payment Amount

RegEx: \z\n\n\d\d?.\d\d?.\d\d\d\d\b+{[$]\d\d?\d?\d?.\d\d}

No formatting error, does not parse 124.01***


Zone: Payment Account

RegEx: Acct # {.*}

No formatting error, does not parse Acct # 8773 10 314 0196171

 

I did test this in Expresso, and got the same results. 


And viewed this thread:

https://answers.laserfiche.com/questions/46981/Questions-with-Topic-Quick-Fields

where the RegEx testing button did not seem to work consistently.

0 0

Replies

replied on January 27, 2016 Show version history

Quick Fields 7 and Quick Fields 8 (and higher) use slightly different regex classes under the hood. Quick Fields 7 used the C++ implementation of it, but as we moved Quick Fields to .Net, we started using the .Net regex class. There are a few differences, but not enough for most people to notice.

{} are not group delimiters in .Net's regular expression. All your examples above should be using parentheses instead.

Edit: for the record, I was thinking why 8.0.1 and not 9 (since it's backwards compatible with older LFServer versions) laugh

2 0
replied on February 9, 2016

Well, this ended up going a little deeper than parens vs. brackets. Here are the above Quick Fields 7 regular expressions, translated to V8.  Note that we have not tested these against all the variations yet, but so far they seem to work very well.  Hopefully this helps someone else.  I'd also recommend using Expresso, a very nice and very free RegEx editor and pattern builder.

 

Regular Expressions, V7 to V8:

 

CHECK DATE  Allows for 1/1/16 or 01/01/2016, or anything in between.

(?<Month>\d{1,2})/(?<Day>\d{1,2})/(?<Year>(?:\d{4}|\d{2}))

Replaces: (\d\d?.\d\d?.\d\d\d\d)

 

FIRST NAME

(?<First>^\w*)\s+\w?\s?\w*$

Replaces: {\w}\b\c?\b?\w$

 

MIDDLE INITIAL - Captured when there is a word, a space, a word and space and a word.  e.g. First MI Last.

^\w*\s+(?<MI>\w+)\s+\w*$

Replaces \w{\b?\c?}\b\w

 

LAST NAME - Assumes at least one character and one space before the last name.

\w*\s(?<Last>\w*)$

Replaces 

\w\b?\c?\b{\w}

 

CHECK NUMBER - Assumes no spaces in the check number

(?<CheckNo>^\d*)

Replaces

{\z}

 

CHECK AMOUNT - We are reading something like this:  $123.45********** 

\$(?<CheckAmount>\s?\d*\.\d{2})

Replaces:  \z\n\n\d\d?.\d\d?.\d\d\d\d\b+{[$]\d\d?\d?\d>\d\d}

 

PAYMENT ACCOUNT

Acct # \s?(?<AcctNo>.*)

Replaces: Acct # {.*}

 

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

Sign in to reply to this post.