Matches with Regex

Hi!
I’m having a problem when using the activity matches.

I want to extract a text that exists between two labels. Dirst i’m doing a get visible text and the i created 2 labels with specific words, and i want to extract the words that are between them.

But in this case, the first label is in one line and the second label is in the order line. When i try to run the workflow it shows the following error:

Source: Assign

Message: Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:

System.NullReferenceException: Object reference not set to an instance of an object.

at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)

at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)

at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Does this ever happened to anyone?

Best regards!

1 Like

Hello @Natasha_Moreira
welcome to our community
as per my understanding when you assign variable that value you assign that is null.
please check that point

Happy Automation

2 Likes

Hi,
this error comes when you don’t have anything in the variable, try sending the get visible text output to a string variable and then see if it works.

Let us know if this works,
Regards,
Pavan H

1 Like

Hello!
Thank you for your reply!

I already tried your solution and it’s not working…

The text that a get from the “get visible text” activity is the following:
"
Sobrenome Moreira
ConComo Natasha Moreira
"
I want to copy the text that is between “Sobrenome” (my first label) and ConComo (my second label). So the RPA as to get the value “Moreira”, for this case.

Maybe is doesn’t show the text because the second label is in a different line.

Is there and example like this that you can show me how have you done it?

Thank you!

Hi!
Thank you very much for your reply!

Well, there is a value between my two labels. So it doesn’t make sense that the value of my assign is null.

I think it doesn’t get the value because my first label is in one row and the second one is in another row.

Does that make any sense to you? Do you have an example like this that can solve my problem?

Thank you.

Hi,
Use split(stringVariable," ") and store in a array variable and then you can get the “Moreira” in array(1).

Let us know if this helps.
Regards,
Pavan H