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

Question

Question

Regex working in Editor but not in actual process.

asked on February 21, 2018 Show version history

So I finally decided that I need help on this one guys!

My regex is working fine in the token editor and when I run the test (I have also run this and several other expressions within an online regex tester and all of them provided the exact response I was looking for) but when I run the process in Quickfields on the actual document, it's adding the second line from the OCR or just not working at all. I can't post the exact test I am running due to confidentiality reasons but I will replace the name for troubleshooting purposes.

Client Statement

Statement for the Account of

JOHN DOE SMITH

JDSM01

 

I have a zonal OCR on the area in which I am locating this text. What I need to do is make 2 separate tokens, one for the Client Name and one for the Client Number. This is the expression I've had the best results with in all of the editors I tested it in.......

 

Statement for the Account of\s*\n*(\w.+)\n

I need to get 'JOHN DOE SMITH' but all characters on the line after 'Statement for the Account of' (as the names will always vary)

 

I'm getting the full name and removing the client number underneath it on all of my tests both in Quickfields and a regex tester, but when I run it on the document I keep getting the client number added to the end with no spaces.

I also need to get the client number as a different token but I think I have that one working correctly already.

Can anyone direct me to a better approach and possibly help me understand why it works in all tests but not on the actual document? Thanks!

0 0

Replies

replied on February 21, 2018

The OCR in Quick Fields may not be picking up the space between the client name and the client ID as a new line.  Have you tried putting \r at the end instead of \n?  See if that makes a difference?

Statement for the Account of\s*\n*(\w.+)\r

Or as a possible alternative, are the client IDs always going to be the same number of characters?  If that is a constant number, you could try just adding the number of characters at the end instead of a line break or new line.

Statement for the Account of\s*\n*(\w.+)\w{6}

 

 

 

1 0
replied on February 21, 2018

I tried your first response, which gave me what I needed in the editor, but not when I ran the processes on the document. I still got the client number at the end of it.

 

I'm not sure if the client numbers will always be the same number of characters, I will have to confirm that. 

I did run the second one regardless, which again ran perfect in the editor but I just got "JOHN DOE" no SMITH when I ran it on the process.

So that's closer!

 

 

0 0
replied on February 21, 2018

I was able to get what you are looking for using

Account of.*[\n]+(\w.*)

 

1 0
replied on February 21, 2018

I ran this one and it gave me just the client number underneath, not the name.....but I need that too so I can use that one for the second token!  The expression I ran previously gave me an unwanted space at the beginning that I was trying to remove. So thank you I can still use this :)

0 0
replied on February 21, 2018

I don't understand why all of these regex work in the token editor, and in the online regex tester....but not in the Quickfields process.

0 0
replied on February 23, 2018

Account of\s+(\w.*)\s+\w.* <--- should give you John Doe Smith

Account of\s+\w.*\s+(\w.*)  <--- should give you the account number

 

For some reason I think the OCR is treating it as one line.

0 0
replied on February 26, 2018

Thanks so much Darrell for taking time to help me out. I really appreciate all the input!

The second one for the Account number works perfect! 

Unfortunately when I put the first one for the name into the editor I'm getting the correct full name but when I run it on the page I'm still only getting John Doe, no Smith.

replied on February 23, 2018

The runtime behavior is correct. (\w.+) matches "JOHN" as \w and everything following it as .+

Use ([^\n]+) to indicate you want to match everything on the line but not go past the end of that line:

Statement for the Account of\s*\n([^\n]+)

If you're running Quick Fields 9, the mismatched test and runtime behavior when evaluating newline characters in multi-line text is a known issue (#128923).

 

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

Sign in to reply to this post.