Regex Match's first match assign as a variable


Hello,
I am trying to attaching first match as a variable. However I am getting an error about can not assign object as a string.

How can I assign first match as a variable ?

Any help will be appreciated.

@DKacmaz - please change your for each type variable type to system.text.regular.expressions.match

like this:
if you have only 1 capture group eg ([\d]+) you can just do:
item.Value

if you have multiple capture groups eg ([\d]+)aa([\d]+) you do:
item.Groups(1).Value for first group
item.Groups(2).Value for 2nd group

and make sure the typeArgument of your foreach = System.text.RegularExpressions.Match