Split string for shorter mail subjects

Hi all,

Currently I am trying to retrieve an order number part of an email subject as part of a bigger process built into a flowchart in the Uipath ReFramework’s ProcessTransaction state. Now the issue is that when the mail subject is shorter than regular, the split string code I use is no longer working.

Example email subject:
Bestelling Client prdt_40394/284900/16 Prijs volgens Offertenummer: nothing031218.01.fhp

Split string inside assign activity:
mail.Subject.Split(“”.ToCharArray)(3).Split(“/”.ToCharArray)(0)

Example output:
prdt_40394

So in case of the following mail subject, I want to retrieve the same output, what should I change to the assign split string code or should a add a flow decision?:
Bestelling Client prdt_40394/284900/1

Would really appreciate if someone could help me out here. Thanks in advance!

Split string is awesome, but have you try using regex?
I recommend using matches if it has a specific pattern. Not only you will be able to get what you’re looking for also all the pattern matches and do what is more convenient for you using a for each or something as an example.

image

1 Like

Hi @MCMFagro

Welcome to the community!

Hope this might be helpful to you.

https://rpageek.com/uipath-string-manipulation/

cheers :smiley:

Happy learning :smiley:

Hello @MCMFagro
you can use regex to get the desired value
Use
System.text.regularexpression.regex.match(Yourvariable,“prdt_\d+”)
In an Assign Activity or can use Match activity and input prdt_\d+ this regex pattern.

Hi guys,

Thanks for the quick response! After puzzling a little with the suggested Regex solutions, the desired result was reached. Really appreciate your help here.

1 Like

Hi @MCMFagro

No worries :smiley:

cheers :smiley:

Happy learning :smiley:

1 Like

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