Help to Get Row from Data Table with c#

Hi, I am trying to get one of the row(where have matches pattern) from data table to match email body. May help me on the get row data & output value?

i tried: CurrentRow.Equals(“RegEx”).ToString()

output i set to write line but not able to get each pattern text:

Kindly help on the get row and how to add to new data table with the result?

Hi @balaraj.pubalan

Give like this

CurrentRow(“RegEx”).ToString

Regards,

i follow this in minute 27 (UiPath: How to Extract Outlook Emails with Regex (Full Use Case) - YouTube)
but i need it in c#

image
i have error

Hi @balaraj.pubalan ,

Could you replace the ( ) Brackets with Brackets and check ?

CurrentRow["RegEx"].ToString()

Thanks. the error is gone now. but the output is same. any idea?

@balaraj.pubalan

Print like this:
ieMatchList(0).ToString

@balaraj.pubalan ,

Could you let us know what is the output representation you need ?

Modify the Write Line Expression to the below and Check :

String.Join(Environment.NewLine,ieMatchList.Cast<Match>().Select(m=>m.Value.ToString()).ToArray())

Hi,

Can you try to use the following in WriteLine activity?

ieMatchList.First().Value

image

Regards,

I get error for this :frowning:

Hi @balaraj.pubalan

The matches output in IEnumerable collection datatype then we have to take the index for first match.
ieMatchList(0).toString

Show the properties of matches activity.

Hope it helps!!

@balaraj.pubalan

Try this

ieMatchList(0).Value

@balaraj.pubalan

Try this

It works

this works but some cannot get the value. should i check with the regex pattern?
image

image

Sorry…i beleive this is in VB. i need it in c#

image
This works

ieMatchList[0].Value

Try this one this is C# code
firstMatchIndex = matchesCollection.ElementAt(0).Index

1 Like

Hi,

The above message shows there is no matched data. If it’s not what you expected result, please review your pattern.

Or if there is possibility no matched data, please check if matched value exists as the following.

image

or
@supermanPunch 's expression also may help you.

Regards,

2 Likes

image
This also can use

but i have some error on the output
image