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

Question

Question

Pattern Matching in QF

asked on July 13, 2022

Hi, I'm trying to extract a payment amount. I'm in QF. Can someone see what I'm doing wrong?

EOB Payment.jpg
EOB Payment pattern matching.jpg
EOB Payment.jpg (45.72 KB)
0 0

Answer

SELECTED ANSWER
replied on October 11, 2022

Changing it to this should let it capture commas:

PAYMENT AMOUNT\s*([\d,]*\.\d{2})

Basically, instead of allowing only digits before the period, any character in the class "digit or comma" is allowed.  Not that this is too relaxed for validation: e.g., "1,,1,2.01" would be considered valid, but should be just fine for data extraction.

Also, the original regex should have had a \ before the period to indicate you wanted a literal period, not "any character".

1 0

Replies

replied on July 13, 2022

Hi Carlos,

Not a regex expert here, but try changing your \s to \s*

That should allow for any amount of whitespace, rather than whatever Quick Fields determines is "1 whitespace," which might be what your pattern is looking for.

0 0
replied on July 13, 2022

In addition to what Jacob said above, you need parentheses around the data you want to extract.

0 0
replied on July 13, 2022

Yessssss they both worked. the \s* and parentheses!!!!! Thanks a million!!!

0 0
replied on October 11, 2022

Hi all,  after using this expression  PAYMENT AMOUNT\s*(\d*.\d{2}) I've noticed the anything in this format 5623125.02 without the comma will work. However, there are times when  I see some without commas and some with commas.

will work= 5623125.02

will not work = 562,3125.02

Not sure what I'm missing in this   PAYMENT AMOUNT\s*(\d*.\d{2})   to have both version above work.

0 0
SELECTED ANSWER
replied on October 11, 2022

Changing it to this should let it capture commas:

PAYMENT AMOUNT\s*([\d,]*\.\d{2})

Basically, instead of allowing only digits before the period, any character in the class "digit or comma" is allowed.  Not that this is too relaxed for validation: e.g., "1,,1,2.01" would be considered valid, but should be just fine for data extraction.

Also, the original regex should have had a \ before the period to indicate you wanted a literal period, not "any character".

1 0
replied on October 11, 2022

There is a website that lets you test these expression. By chance you have that link?

0 0
replied on October 11, 2022 Show version history

There are many, but make sure you're using a .NET regular expression engine or site specifically for .NET regular expressions.


Here are two:

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

Sign in to reply to this post.