langsem
(Langsem)
July 4, 2019, 8:03am
1
Hi i want to match the words Mo i Rana. I cant figure out
Hurtigruta Carglass AS\r\n1(1)\r\n(Ensjøvn. 17)\r\nPOSTBOKS 6452 ETTERSTAD\r\n0605 OSLO\r\nForetaksregisteret NO 985758220 MVA\r\nKunde 100454 Avdeling Mo i Rana\r\nBank\r\n4202 33 70055\r\nTRYG FORSIKRING\r\nIBAN NO77 4202 3370 055\r\nPostboks 7070\r\nSWIFT SPTRNO22\r\n5020 BERGEN\r\nTlf 98709500\r\nFax 22 70 76 01\r\nregnskap@hurtigruta.no\r\nDeres referanse\r\nwww.hurtigruta.no\r\nFAKTURA 14780866\r\nFakturadato 08.06.2019 Skadedato 07.06.2019\r\nForfallsdato 08.07.2019 Reg.nr. EK71995 Vår referanse Avdeling Alnabru\r\nKID147808661\r\nLeveringsdato 07.06.2019 Kundens ordrenr\r\n0000456218\r\nVarenr Varetekst Antall Pris % Sum\r\nRep av frontrute\r\n50 REP-1 1,0 STK 650,00 650,00\r\nm.v.a. av kr 650,00 162,50\r\nTotalsum: 812,50\r\nAvrunding 0,50\r\nSum å betale: 813,00\r\nBankkontonummer: 4202 33 70055\r\nBiler med fradragsrett for merverdiavgift, skal svare denne avgiften i tillegg til en eventuell egenandel.\r\nFor disse bilene dekker forsikringsselskapet kun netto faktura
Sunil46
(Sunil)
July 4, 2019, 8:13am
2
@langsem U can see below thread that will help.
Hello
I am trying to catch the text after the word Uipath in this text
The length and words in the pdf / text files are not always the same. But the word Uipath wil always be in the text
[image]
langsem
(Langsem)
July 4, 2019, 8:17am
3
Did look at it, but its working in my case the thing its that Mo i Rana its name of branch, so i could be something different on another pdf file. It could be Oslo, Kristiandsand, Sandefjord Kilen etc
So need a regex expression that look intbettwen maybe Avdeling and Bank i tried with (?<=Avdeling\s)(.*)(?=nBank) but it gave me blank
You can use this regex to find those two words that you wanted
\w*(Mo|Rana)
If you want regex to look between two words you can use something like this :
Avdeling([\s\S]*?)Bank then select group 1 matching with Assing activity : StringThatYouWant = OutputRegex(0).Groups(1).Value
langsem
(Langsem)
July 4, 2019, 8:21am
5
its almost working, it gives me another line aswell tho
langsem
(Langsem)
July 4, 2019, 8:23am
6
currently my assign look like this
branch = System.Text.RegularExpressions.Regex.Match(PDF_INVOICE_STRING, “(?<=Avdeling)\s\w+”).ToString
That only finds words thats one word like OSLO, Sandefjord etc
So its missing words that contains like 2-3 arrays like Mo i Rana , Sandefjord Kilen etc
Sunil46
(Sunil)
July 4, 2019, 8:29am
7
Try this once:-
(?<=Avdeling\s).*(?=\snBank)
Yes, because there is multiple matches.
When you use Matches Activity in UiPath you can use this Regex expression, and then the output will be in RegularExpression Array, so you need to select first match ( the 0 index)
Main.xaml (5.9 KB)
Hope this helps
Also, if you have multiple result you can always use For Each to get each element like this
langsem
(Langsem)
July 4, 2019, 8:33am
11
almost working, the ouput its Mo i Rana\r\n
Yes, because the \r\n is in your text
langsem
(Langsem)
July 4, 2019, 8:36am
13
so a replace \r\n\
would work ?
You can use Replace string method
Main.xaml (6.9 KB)
1 Like
system
(system)
Closed
July 7, 2019, 9:10am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.