How to deal with REGEX matches exceptions

Hello folks!

I’m having an issue with a project i’m building now. I’ll give you a short briefing of it:

I’ve a scanning system called Kodak. When I scan any document, the system applies an OCR on it and gives me a PDF (with ocr), a TXT (with the extracted text from PDF) and a CSV with some metadatas inside.

What am I trying to do?
I’m build a RPA that extracts the data that I define (Name, birthdate, so on…) from the TXT file but I’m having an issue with REGEX because my OCR extraction isn’t 100% reliable. How could I deal with this issue in my automation? I thought about Try Catch activity, but I don’t know if it’s gonna work.

What I want?
When my RPA finds some regex that doesn’t match or doesn’t exists, it just ignores that.

When it works flawless:

When it comes with some issue, usually: Assign: Object reference not set to an instance of an object:

OBS: The one above is what I want my RPA to ignore and keep going.

Before that Assign, you need to have an IF condition like this:
IF iemNome.Length > 0

“Nothing was found”

1 Like

I’ll try it!


Didn’t work… =/

Even before Assign Activity it isn’t working

I’d like something like:

If “Object reference not set to an instance of an object.” occurs
Then: Ignores and keep working.
Else: Keep working

Oh, then you use a Try Catch…

1 Like

It worked! Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.