I have a problem. I need to find all the Contract numbers in a csv that results out of a Get Visible Text Activity. I wrote them into a csv file and got this result:
Name;Vorname;<Datum Betreff;;Name;;Vorname ID des Anhangs;
Benutzercode;Durchwahl;Uhrzeit Gelesen;;Code;;Durchwahl Kommentar des Anhangs;
Meier;Marcel;30.10.2019 A-Konto-Zahlung Vertrag 7732151;;Schnitzel Petra;;978404;
Meier;2112;14:36:12 26.11.2019;;Schnitzel;3103;A-Konto-Zahlung Vertrag 7732151;
STOPDAGEHT;Eveline;08.08.2019 A-Konto-Zahlung Vertrag 7652254;;Kurz Hartman;;978334;
STOPDAGEHT2104;;15:08:50 . .;;Kurz;;3105 A-Konto-Zahlung Vertrag 7652254;
I need to get the 7 Digit-Number after the word: Vertrag There is always a “;” behind it. Please help.
if the above string is input for variable str_input
in MATCHES ACTIVITY with that str_input as input and expression as
this will give us
and if we need all numbers next to Vertrag with no digit count restriction then
as @KMota suggested that would work
Thats a great support! I love this commuity! Very fun to work with this.
Can somebody show me the syntay on how to use this in an assign activity?
My variable is test
You can use the Matches activity, and then for each match, do the actions, since all the matches will be stored in a collection variable.
Hope that helps
Thanks for your help. But I don’t get it to work properly.
So I’m reading out the text. Then generating a DT and a CSV. Then I use the Matches Activity.
Then I use a Write Line to see what is in the collection. This only works when I use to String. But the Output is trash
" System.Linq.Enumerable+d__97`1[System.Text.RegularExpressions.Match] "
Thanks for helping Guys
the toString() will output the Datataype. It is recommended to:
- set breakpoint and inspect variable content in the locals panel
- iterate over the Enumerable “Collection” and output the looped item
Wird schon irgendwie klappen, ansonsten sind wir ja für dich da
Yah you are almost done
It would be like this
str_output = System.Text.RegularExpressions.Regex.Match(test.ToString, (?<=Vertrag\s).[0-9]+).ToString
Where str_output is a variable of type string
As you have mentioned Match activity it will give only one match
If we have used Matches which would give us many such matches then the assign activity would be like this
match_Values = System.Text.RegularExpressions.Regex.Matches(test, (?<=Vertrag\s).[0-9]+)
Where match_Values is a variable of type
What that’s a lot of info and help! I will just input my Workflow here. Basically what I want it to do:
Extract the Visible text find the Contract Numbers and Write them all in a CSV File. Each in One Line. Any Ideas?
Maybe the workflow helps.
Read_it.xaml (8.5 KB)Hobbit.txt (6.6 KB)
Please use the below syntsx -
Hope you will find your solution.
Thanks & Regards,
At what point or in which activity in my Workflow should I put this? Thx
You can use assign activity and create a variable with string and write the code in assign activity like above mentioned
You will get the matched value then you can use for your process.
For your reference try this
Regex.zip (11.1 KB)
Hope this helps!!!
This is great aman! Thanks!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.