Regex Match ( Assign: Object reference not set to an instance of an object)

Hi,
I have been wondering how to handle this error ( Assign: Object reference not set to an instance of an object).
I have a Regex Match activity
image
And Assign activity


That’s when the error occurs. I verified that regex works on https://regex101.com/ and https://regexr.com/ and https://www.regextester.com/.
Additionaly ^ and $ signs are not used with regex pattern.
Any suggestions? Much appriciated!

—UPD— Is it possible to use more than 1 regexp in one match activity?

1 Like

Could you provide an example of a text you want to extract and the patter used?
Your problem could occur from the reading of the PDF rather than the regex so try printing your text on the screen first.
You can use the multiple regex expressions by using the “|” operator between them since it acts as an OR.

1 Like

Is " | " strictly OR ? because i would rather want to combine multiple patterns, thought I had to go for AND
I double checked it . Extracted PDF string does not come blank, and I copied its content from output panel to verify that regexp works when designing it.

If you want to combine multiple pattern then “|” is exactly what you are looking for.

If I have for example a line that either starts with “start” or with “begin” and then digits, I would use something like “start\d+|begin+\d” or even simpler “start|begin\d+” which are two separate patterns.

image

Regarding the problem with the PDF string, i would suggest inspecting the message details if you have not done this already as below by double clicking on the output for any hidden characters but I cannot do anything else without an example.

image

1 Like

Hi,
I am having a problem with matches and regex function. When I execute following sequence I cannot extract values includes in last PDF page, for the rest of pages sequence works properly. For example, if I have number “1” in all pages and I have 7 pages, I get only 6 “1”, for the next one I get following error “Assign: Object reference not set to an instance of an object.”. Could you help me to solve it?