ERROR : Source: Assign "Message: Object reference not set to an instance of an object."


Im trying to capture hyper link of element by using Matches activity . If hyperlink is not present it should return NULL, but throwing an ERROR. Attached WF pls help. In this WF Hyperlink "View Detalis " is not present it should return NULL. splitstring.xaml (10.6 KB)

Remove unreferenced variables if not using.

1 Like

Removed,but Im getting same error.

It gives you the result, not the error. But i don’t know what you are expecting in message box.

Hi Jiban,

I’m trying to store the result in a variable, message box is just an output for me. In this case if the regex doesn’t match, NULL used be stored.I’m getting Error Pls Help

Try outputting the Count of the matches, so like

If that shows 0, then it’s nothing. The “IsNothing()” might not be working correctly. You can alternatively have the condition as: iEnumResults.Count = 0

1 Like

HI @ClaytonM,
How to count the matches can you pls provide us an example

Hi. Refer to the example in my last post. You can take the variable you used and add a .Count on the end


To output in message box add .ToString on the end

iEnumResults is essentially a list or array of matches.

1 Like

Sorry @ClaytonM can you pls provide me your last Post.

Here is what I mean:

Hopefully that makes it more clear. Thanks.

1 Like

@ClaytonM ThankYou So Much its working Fine.

Hey @ClaytonM!

You have highlighted a very valuable point when it comes to error handling workflows where Regex Matches don’t get a result because of either user error or the expected match does not exist in the input (probably an optional field).

I have added this scenario to the Regex Troubleshooting section (its not an exhaustive list) of my Regex MEGAPOST to help new users to Regex.