How to spit string in notepad

Hi,

i wanted to split all email id’s with user name in bracket as one and to write in excel in each row.
i want “kumar,pravin - pravin.a.kumar@abc.com (pkuma144)” in one line and next to another ans so on.
how can i split this string?
here is the ss of text file.
ssg

please help me with the same.
Thanks.

Hi,
check this topic:

how can i write each item in each row of excel?

Create a new datatable. After you split the string into a string array and have it formatted the way you want, use a for each activity & change the typeArgument to string. Within that for each loop, use the ‘add data row’ to add the current string to the datatable you created. Use excel write range to put it into excel after you finish the for each loop

u have any demo to show? because i am stuck while splitting
is i have to use regex and all and deserialize jason?

You need to use your inputs to determine the best way to manipulate the string. This is an extremely common thing to do in almost all workflows so I’d highly suggest trying on your own to figure it out. From the limited info we have based on the screenshot, it looks like you can use the closing parenthesis ) as the delimiter to split the string - use that as your starting point and let us know if you’re having issues with any specific part

No need to use regex unless that is your preferred method, but I would recommend just using strings.split or string.split instead. The format doesn’t appear to be JSON based on your screenshot

Hi,

I made changes as per u suggested but writing same name means first name only in loop
dsfsf
here is the script ss
gfgs

@Mathkar_kunal - I know this very amateur Regex…but this may help you.

I am trying to build a good one , until you can give it a try…

Output

RegEx Pattern: (\w+,\w+\s±\s\w+.\w+.\w+@\w+.\w+\s\W\w+\W+)

Updated: image

sure bro i will try

@Mathkar_kunal - Here you go…

Output

image

@Mathkar_kunal your screenshot is cutoff so we cant see what is in the for each loop? The part above looks fine, but the code within the for each loop needs to be changed so it isnt grabbing the same text each time

EDIT: Although regex could work fine, that is going to be a huge pain to debug in the future because it’s not easy to decipher what “(\w+,\w+\s±\s\w+.\w+.\w+@\w+.\w+\s\W\w+\W+)” is doing at a glance lol

@Dave - Regex is easy…see below…

2 Likes

what is the value u used as input in maches? as i a using regex for first time so dont know much about it.
i am getting those ids by get text first and then splitting and used that split variable in matches.

@Mathkar_kunal - This is my input.

Whatever you posted in the initial post, I took that string …So in your case, wherever you getting that whole string , pass that as a input.

Also, You also have to fix the pattern. This is updated short one…

image

@Mathkar_kunal - This is just alternate approach…if you are not familiar with Regex, as @Dave suggested please follow the string manipulation route…

@Mathkar_kunal you were very close, you likely just need to update the formula in your for each loop. As I asked before, can you update your screenshot to show what is in that for each loop? It is cutoff in your picture but that’s where your issue lies

EDIT: It’s also helpful if you include the input as text here, or at least attach as a .txt file. If you just have a screenshot people are much less likely to help because they don’t want to retype out everything themselves from the image

1 Like

thanks for the help .worked for me.
i want to learn regex can you tell me how you created that pattern?

thanks for the help and suggestion. worked for me.

@Mathkar_kunal…Thanks…could you please mark my post as solution.

There is Regex mega post in this forum, pls search for it and there is video link inside which really an awesome source.

yes i already marked.
can u provide me link for that post

1 Like

@Mathkar_kunal …please chk here

Regex help tutorial MEGAPOST – Making your first Regex post, Reusable Regex Patterns, Regex Troubleshooting, Sample Workflow and more

2 Likes