Matches - extracting date / digits from from Read text file

Hi. I am saving and reading text attachments from mail.
After I have read the text-file to a output variable, i am using Matches to extract the date from document.

My problem is that i cant get the pattern right.

I am trying to get the date marked in red, but my problem is variable words marked in yellow, and all the spacing in between “reg.fond” and the “date” marked in red.

I am using pattern: (?<=pasientskadeerst.).*?(?=\nBruker), but that marks “reg.fond” and alle the spacing in between: “reg.fond_____________________________200305”

I only want the last 6 digits (200305).


Would this pattern work?


It just looks for any 6 digits in a row. I don’t see anything else in your snippet that would get caught by this.

The snippet is just from the heading. The text can contain a lot of digits later on, depending on purchase.

It might be worth a try, but if that doesn’t work, here’s one that looks for “reg.fond” to locate the date:


You will have to trim the result, however, as the spaces will still be in the extracted date.

Havent done a full test yet, but this seems to work: “\d{6}.*(?=\nBruker)”
That seems to limit the split to the heading.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.