Assign value to IEnumerable variable

Hello guys,

I am scraping an website and using Regex to extract a value, but sometimes this value is null and I get an error.

I want to set an IF to check if either this value is null and to assing an string if so but I dont have an idea on how to make this work.
Anyone can help me with this topic?

Thank you! :slight_smile:

surround the activity with Try Catch Block and Catch the null reference exception and in the catch section assign the string.

Ok, but how can I assign a string to an IEnumerable variable? :smiley:

the output of Matches Activity is an IEnumerable(Of Match)
So we are bound to datatype of this IEnumerable
Adding a String to IEnumerable(Of Match) will conflict with Datatype definitions

As it is an → I<-Enumerable it is designed for readonly and represents not a collection with the functionality of adding an item to it

A straight forward approach would be to check if Matches is filled or not e.g. by
If Activity: Condition - yourMatchVar.Any() - returns false in case of no matches

Another technique is to provoque a default Match in case of it is empty like:
first line: text ABC, pattern \d
second line: text A3C, pattern \d