I get a mail and mail consists of 3 thing.
how can i extract each value to variables. i want to save London to a “city” variables England to “country” the code to “postal_code” variable.
I though and tried to do with regex but couldnt make it work.
Thank you all.
btw mail is sent like above:
so kinda like the first 3 rows is what needed
maybe this regex-pattern works for you: (.)\n(.)\n(.)\n
edit: after the dot . must be an asterisk, the forum doesn’t write it in my answer.
\n is the pattern for a new line, so you get the 3 lines as full match and each line as a group.
You may specify the patterns for (.) with some more details, maybe only digits for the third line.
edit: I use regex101.com to test my patterns.
thank you how can i assign the the 3 values to variables?
You need a IEnumerable variable. You give your mailtext and the search-pattern to the match activity and get the result in the variable YourIEnumerable. Then you can assign the values to different variables. I attach a xaml.
regextester.xaml (5,5 KB)
Hope it works for you!
you can use split method
create a variable of type array of strings ex. infoArray
you will get the three lines into array items
I think with splitting you will get problems with a city like New York, because you split the name.
thanks for your link, I’ve stored it in my bookmarks. It’s a great post about regex!
Yes, you are totally true
I tried this one, not working tho the logs are like this:
and also split is fine london england is a represntitive there wont be more than 1 word in a line. But im not sure how to use it %100.
Maybe there are more than one characters for a new line in your mail. Did you try your sample and the pattern in regex101.com?
I’m not so familiar with splitting a string, so I don’t know exactly how to use it.
See the attached file for an example on how to use Split() SplitThreeRows.xaml (7.2 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.