Get a particular text using regex

The below users are

Output needed
User 1-Quy



Can anyone plese help me with some regex concept

1 Like

I hope rather to regex split method would more easier here
kindly have a look on these steps
–if this text is saved in a string variable like this
intext = “Quy-devqnx
–then use a assign activity and mention like this
outtext = intext.Split(Environment.Newline.ToArray())
where outtext is a variable of type string array
–now use a for each loop and pass the above variable as input and change the type argument as string in the property panel
–inside the loop simply use a assign activity like this
out_user = Split(item,“-”)(1).ToString.Trim //output is Quy
another assign activity with
out_user = Split(item,“-”)(0).ToString.Trim //output is devqnx

so for each iteration we will be getting the user and the id value with this variable

Cheers @Karthikeyan34


The regex pattern to get before - is “.*(?=-)”
And after the - is “[^-]+$”

Hope this helps

Aman sheik

1 Like

Thanks aman_sheik

thanks palaniyappan

1 Like

So any issues to be discussed still
Cheers @Karthikeyan34

yes …i Just want to read only the Unread mail messages i am using pop3 it dosentg have such options like Imap then how can i do that

1 Like

Hope there is no such option in POP3 and i would suggest to go for IMAP as we have got that option to read only unread mails
but still we can check whether a mail is read or unread but only after getting all the mails, which is not a feasible way of handling
So Better lets go for IMAP

Cheers @Karthikeyan34

for split string assing activity there is an error (string cannot be converted into system.array)

1 Like

otherwise one dimensional array cant be converted into string

There must be two reasons
Either the outtext variable is not set as string array
Kindly change it from string to string array of not yet changed

If this intext is if single line and not of three lines then the outtext should be like this
outtext = split(intext,” “)
The remaining same

Cheers @Karthikeyan34

Unable to cast object type of system.char to string a error occurs while entring for each

1 Like

Can i have a screenshot of the error in the studio if possible
cheers @Karthikeyan34

error : Index was outside the bond of an array …in assingning outtext