Hello,
I am trying extract info from the subject line in Gmail inbox. The info I need to extract will always be in parentheses and there might be multiple numbers separated by commas. So for ex: if the subject is (123456), (175967), (123123) it would extract 123456, 175967 and 123123
You can use a regex βMatchesβ activity with the pattern (\d+)
It would be sufficient to just do like:
ArrayNumbers = β(123456), (175967), (123123)β.Replace(β(β,ββ).Replace(β)β,ββ).Replace(" β,ββ).Split(β,"c)
So in that case
Is str_input = β(123456), (175967), (123123)β
Then the expression be like this
str_output = str_input.ToString.Replace(β(β,ββ).Replace(β)β,ββ).ToString
Or
**If the subject has few more words apart from those **numbers and brackets and if we want to get those numbers alone then use MATCHES activity and mention the input as str_input and expression as β\W\d+\Wβ
And get the output with a variable of type match collection
βnow use a FOR EACH activity and pass the above obtained variable as input and change the type argument as system.text.regularexpressions.regex.match and inside the loop use a assign activity like this
str_output = str_output + item.ToString + β,β
Next to this for each loop use a assign activity like this
str_output = str_output.TrimEnd(β,β)
Cheers @Peter.k
Thank you all for your help, I will try these and see if I can get it to work. Much appreciated!!
Cheers @Peter.k
Quick follow up. I was able to extract them correctly but now I want to split them. So for example, Iβve extracted 123456, 167890, 190567 and I want it to first take 123456 and enter it in our software, then take 167890 and do the same etc. Whatβs the best way to do that?
the solution i gave you does thatβ¦
sorry youβre right, will try that now. Thanks again!