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

Question

Question

Quickfields Pattern Matching - New Lines

asked on March 31, 2021

I am unable to get Quick Fields pattern matching to work properly using the OmniPage OCR and Pattern Matching. It works when in the test of the token editor but I get a different result when I test the process. I'm trying to use regular expressions to match the text that is in between certain text. Example:

TO:

Company Name

Company Address

I am able to get the company name in the token editor with (?<=TO:)(.*)(?=\n) but it matches everything else when I test the process. I've tried changing (.*) to (\w*) and changing (?=\n) to just \n but neither has worked. Also, another token that is matching a date works just fine using a similar expression. Is there a way to only return the text between specific text and a new line.

0 0

Replies

replied on March 31, 2021

Pattern Matching is "greedy", so it will try to match as much as possible. (.*) will match everything. If you want it to stop at the end of a line, you want to go with "anything but a newline character" instead of "anything". Try ([^\r\n]+) instead of (.*).

0 0
replied on April 2, 2021

Hi Miruna,

 

Unfortunately, this did not work for me.

0 0
replied on April 20, 2021

I had a similar problem when trying to apply a RegEx to a multiline OCR field. \s, \r, \n in various combinations would not allow me to get to the data in the next line.  Removing these also did not work.

Let's say we were reading:

Invoice Number:

12345

It would catch Invoice Number with no problem, but would not transit to the data I wanted.

 

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

Sign in to reply to this post.