Regular Expression for email data

HI
we can use this expression to get the NOIDA or any value that comes at that position

str_output = System.Text.RegularExpressions.Regex.Split(text, "\n", RegexOptions.Multiline)(3).ToSttring

Cheers @Dipanshu

@Palaniyappan:

I am using Matches activity and need to put only pattern property. As you had given me solution like to get the data after date.
((?<=\d.\d.\s). (?=[^A-Za-z].)).

12-Sep-2019

India

Delhi

Noida

Nairobi

Can we not create the similar Regex with date to fetch the Noida. Only we need to skip India and Delhi.

I hope you understand my query.

kindly use this expression to get the value of Noida or its position value
str_input.ToString.Split(environment.NewLine.ToArray(),stringsplitoptions.RemoveEmptyEntries)(3).ToString

it worked actually

Cheers @Dipanshu

@Palaniyappan:

I can not fix the count. it is the some part of data which i shared here. This is email thread scraped data. I need only regex which should be point out the 4th position (Noida) after date.

@iVishalNayak: Can you create the regex if date year is constant and try to Fetch Noida?

HI @iVishalNayak and @Palaniyappan,

Is any solution?

I didn’t get this buddy
You are saying can’t fix the count
But here with 4th position
Looks in contrast

As you can split the text with INV or any text from email and get the below term we can pass that splitter array to a. For each loop and get the 4th position value of each split so that we will get the value of the position where Noida is now present

Cheers @Dipanshu [quote=“Palaniyappan, post:23, topic:182146”]
12-Sep-2019

India

Delhi

Noida

Nairobi
[/quote]

Were we facing any issue in that
Kindly try this and let know pls

Cheers @Dipanshu

1 Like

@Palaniyappan

This is not split with single inv.

This is the attached split data where I need to fetch third position after each date. (Output will be 3 like Kenya, India, India)

1 Like

Hope these steps would help you resolve this
—use a Read text file activity and read this file and get the output with a variable of type string named str_input
—then use a assign activity like this
arr_lines = System.Text.RegularExpressions.Regex.Split(text, (\d).-[A-Za-z]±(\d)", RegexOptions.Multiline)
—now use a For Each loop and mention like this
As input arr_lines
—change the type argument as string in the property panel
—inside the loop we can use a writeline activity and mention this expression
item.ToString.Split(environment.NewLine.ToArray(),stringsplitoptions.RemoveEmptyEntries)(2).ToString

Cheers @Dipanshu

1 Like

@Palaniyappan:
I tried your solution but it is showing error and not fetching the correct text.
Btw
I have created a regex (“\b(?=India|Kenya).*”) which is showing me 6 matches. Now I am fetching 1, 3, 5 value. Also I have added the multiple if condition for more matches record which can be scraped in another email. Also decrease the count value according the cell.

dt.Rows(counter-2)(“To Country”)=item.ToString

This process is giving me correct output.

Thanks everyone and @Palaniyappan

1 Like

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