Split String Syntax for new line

Hi Team,

This is how it looks like in portal,

image

After using Get text, am getting as below:

"\n \n \n \n LIZALFARO1@GMAIL.COM\n \n +5 more\n \n ",

Can you please suggest how to split the above string value.

Thanks.

Hi @sushmithaelluru
Try below example
yourString.Split({Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)

1 Like

Hey , thanks for replying.
But I got as below,

thats return an array of value you just specify the index
for ex yourString.Split({Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)(0)

Getting like this! I need only email…

Assign → System.Text.RegularExpressions.Regex.Matches(in_Str, "[a-zA-Z0-9!#$%&'*+\/=?^_{|}~-]+(?:.[a-zA-Z0-9!#$%&'*+ /=?^_{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?").Item(0).Value

replace in_Str with your input and you will only get emails out.

I checked, copy this code and it will work.

str.ToString.Trim.Split({“\n”},StringSplitOptions.RemoveEmptyEntries).Where(Function(x) Not String.IsNullOrWhiteSpace(x) AndAlso System.Text.RegularExpressions.Regex.IsMatch(x,“([a-zA-Z0-9_-.]+)@([a-zA-Z0-9_-.]+).([a-zA-Z]{2,5})”) ).ToArray(0)

image

Getting this output.

Sequence.xaml (17.8 KB)
image

Check your Result Datatype. my code return as string …better send your workflow?

Just create new string variable and assign that code.

But getting the same error.Test1.xaml (10.8 KB)

i saw your code if you want to use an array use the below code to Email_Array variable

Email_Array=Email.ToString.Trim.Split({“\n”},StringSplitOptions.RemoveEmptyEntries).Where(Function(x) Not String.IsNullOrWhiteSpace(x) AndAlso Regex.IsMatch(x,“([a-zA-Z0-9_-.]+)@([a-zA-Z0-9_-.]+).([a-zA-Z]{2,5})”) ).ToArray()

Then print Email_Array(0)

1 Like

If you want a mail array, remove the 0 in the .ToArray(0). In this case, ToArray(something) will return the value (As a string) at the something position, without a parameter, it will return a string array.
In the other way, if you know that you will have only one mail address, you can use a String but not a String [] (String Array). @prakaz25’s code work very well.

1 Like

Hey @Damien, yeah thanks. Sure will try.

Ok !! thank you @prakaz25.

And another thing, .as per my requirement I need to enter some column values from the Input Excel Data into the Portal, if we find those column correct matched value in portal, we need to extract the Email Id and Phone number.

This is the input sheet,

New Microsoft Excel Worksheet.xlsx (10.5 KB)

Now I used open browser for all the Web Portal functionality in For Each Row,
But after each entering input , the new tab in browser is opening.

Test1.xaml (11.9 KB)

Can you suggest me how to rectify that opening new tab in the browser.

Thanks.

Remove the open browser from the For Each Row. Open it before, and inside the loop use a Attach Browser.