How to convert matches output variable to string variable

im using Matches activity inside i used regex pattern to extract certain 4 to 6 lines and i want to convert that ouput variable to string.

Hello @sathish_Kumar6
Just use for each loop provide matches as input and for current item provide .tostring.
Remember (.tostring should be provided to only match variable type not matches.)

1 Like

@sathish_Kumar6

If you are having only one match…then matches activity actually gives to an output of the first or single string as well

cheers

1 Like

Actually i want to extract all the words so based on that only i used another logic so is that possible

You want to store that into an Array and then you can retrieve whatever values you need either by looping or indexing.

Thanks.

1 Like

@sathish_Kumar6

Use a for loop and give matches as in argument and change type argument to match

then inside loop use currentitem.value to get each matched value for each iteration

if you need all at once with comma separation use this

String.Join(",",matchesoutput.Cast(Of System.Text.RegularExpressions.Regex.Match).Select(function(x) x.value).ToArray)

cheers

1 Like

where to give my matches output variable in this

String.Join(“,”,matchesoutput.Cast(Of System.Text.RegularExpressions.Regex.Match).Select(function(x) x.value).ToArray)

okay now i get it so is there any to get all stored in one varibale like all words in one string variable

@sathish_Kumar6

Matchesoutput is the variable where you need to give

cheers

1 Like

ok instead of looping is there any way to get all words in one string variable

im getting error as this

System.Text.RegularExpressions.Regex.Matches(“hello thre 532443 it the otp”,“\d”).ToArray
put Input text variable and replace \d with your expression. you will get the array.
image

Manupulate the array to get whatever output you want.

1 Like

@sathish_Kumar6

Please try this

String.Join(",",matchesOutput.Select(function(x) x.value).ToArray)

cheers

1 Like

Thanks a lot… it worked

Actually my requirement is different @Shubham_Kinge anyway thanks for trying to help me

1 Like

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