Error in the loop

Let me add this example also,
Let’s say your string says this:
“[ some text here. name@domain.com]”

Then, you can pull the email (assuming I get this right) using Regex like this:
emailIDs = Regex.Matches(EmailAdd.ToString, "(?<=(\s))(.*)\@")

Then, using that new enumerable, you can join the matches.
String.Join(",", emailIDs).Replace("]",""), and use it in the Add Data Row

The regex pattern I used may need work, cause just typed it out quick.

Regards.

1 Like

Hi @ClaytonM in the attached screenshot, I mentioned 1 and 2 with yellow color.
I extracted the complete yellow text from the profile. Then use the Regex to filter the only email I’d. But here some candidate have single email I’d and some have two email Id. which I want to extract their email I’d and write in a single excel row with comma, I attached the sample excel screenshot. in the previous post.
image

1 Like

I used this Regex which works fine to extract the email id.
image
and store in a Email variable.

@Palaniyappan see the above bro, I have used.

1 Like

Another option is to just Split by the Newline, since the emails are on the next line.
EmailAdd.Split(System.Environment.Newline(0))(1).Replace("]","")

And, you can use that directly in the Add Data Row, since it will include all emails listed already

Well hopefully I have given you enough tips so you can solve for this.

If your use Regex.Matches() to get an enumerable of the matches, then use String.Join(“,”,emailIDs) in the Add Data Row

If you use another method to get all emails as an already comma-delimited list, then just use that directly in the Add Data Row.

And, you should not need a Loop or anything crazy.

Regards.

@ClaytonM For me EmailAdd variable is used to store the text from the Get Full Text activity. And Email variable is used to store the text after filtering from the Match activity.
image

Cool.

See my point above that shows you can take your Matches enumerable (you say you store in Email), and use directly in Add Data Row with String.Join(",",Email)

However, make sure your Regex is working correctly first to get all emails from the string.

2 Likes

@ClaytonM wow it worked bro. Got the expected result without using any loop and extra activity. Thanks a lot. :slight_smile: :slight_smile:

Thanks to @Palaniyappan and @sandeep13 for your good response!

3 Likes

Fantastic @balkishan
Thanks for the point buddy
@ClaytonM
Cheers

1 Like

Sorry to open the issue again, No doubt it is working fine, But the issue is it’s considering the dot as a comma.
image

How it gives the value in the excel file is

image

@Palaniyappan can you help on this further ?

1 Like

Fine…no worries
Can i have a view on the expression been used with that…
Cheers @balkishan

1 Like

Please see bro.
image

Fine this expression worked for me
(\W.*@[A-Za-z_]+?\.[A-Za-z]{2,6})
Kindly try this once and let know buddy
Well while after splitting the string and getting the value use .ToString.Trim to remove the unwanted space before and after
Cheers @balkishan

2 Likes

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