Regular expression match

Hi,

I have an Regex format of system.text.regular expression.match. How do I convert the same regex op to a string?

@shreyaank

Regular Expression Match activity will give you output as array of matching values.

If you want to print the values then try like this:

outputOfMatch(0)
outputOfMatch(1)
etc…

Hi @shreyaank

Usually this expression System.Text.Regular.Expression.Match returns the first occurence of single Match as a Object, that is a collection of matched values and we get the output with a variable named out_Matches where this variable is of type
System.Collections.Generic.IEnumerable<System.Text.Regular.Expression.Match>
like this

–so to get the value in each index position we must specify the index which can be obtained directly by mentioning the index like this
out_Matches(0).ToString
out_Matches(1).ToString

or

if we dont know the index number for sure we can use for each loop and pass the output of matches activity and keep the type argument property of for each loop as OBJECT
–then inside the for each loop use a write line activity like this buddy
item.ToString
where item is the variable obtained from for each loop

Kindly try this and let know for any queries or clarification
hope this would help you
Cheers @shreyaank

Hi,

Ive attached the screenshot below, the activity is just returning a single value in my case, let me know how to convert to a string. I dont have an array.

fine mention the assign activity like this buddy
out_Datetime = DATETIME(0).ToString
where out_Datetime is a variable of type string
Cheers @shreyaank

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.