Hello,
I’m trying to have the robot go into an inbox, go to each email and grab only the part of the subject line that is in parentheses (it will always be a number). Also, it may need to search for more than one set of parentheses within the same subject line.
@Peter.k
if i understood correctly,only the contents of 1st parenthesis should be extracted right. even if there are more than one parenthesis ?
Subject: sometextoverher (1234) sometextagain (4567) (6779999) fewmoretext
Thanks for your response. The main thing I’m trying to achieve is getting the contents of the first parenthesis extracted. There will be rare scenarios where there will be more than one parenthesis in the subject (separated by a comma). In that case i would want to extract each content in parentheses. Subject sometextoverher (1234) , sometextagain (4567), (6779999) fewmoretext,
@Peter.k this is for first one
first assign activity will hold subject details (i took it as example)
2nd assign will split contents after 1st parenthesis
3rd assign activity will split by close parenthesis and all contents before that will be stored in the updated variable
finally we will print its content using writeline activity
output will look something like this:
Thank you so much for your quick help with this, very much appreciated
Please check if this helps :
- Get the Subject
- Use Matches (If the activity is not available in the activities pane, please go to the Imports pane and choose System.Text.RegularExpressions and try again)
- Provide the Input (the Subject string) , pattern (in screenshot) and Result (The variable to store the Result)
- Loop through the result. The data in the Foreach loop in the screenshot will have a TypeArgument System.Text.RegularExpressions.Match
I have two more questions if you’re able to help me:
- I’m trying to only extract the first 5 digits in parentheses (so for example, if it says (123456 1001) or (123456-1001) it would only extract 123456
- I am still trying to figure out how to extract multiple numbers from the same subject. So for example if the subject says (123456 1001), (145643 2001) it would extract 123456 and 145643
Thanks!