Get the text after a certain word

Hey everyone,

I have a pdf which i convert it to text using Read PDF Text activity.

The output is like a long text so will only write the part I need:

… … … … …
… … … … … … … … … …
… … . . . … \r\nNumber CT1/4561355507 04.11.2020 1\r\n … …
… … … … … … … … … …

I need the “4561355507”, CT1 and the date after the number is not stable they change everytime. But the text “Number” is stable and the " / " before “4561355507” is also stable.

I need to assign “4561355507” to a variable.
Please Help,
Thank you,

@berkaykor
Anchored on Number and /
grafik

(?<=Number )(.*)\/(\d+) (\d{2}.\d{2}.\d{4})

refering to the groups:
grafik

How can I use this exactly, how can I assign these to variables

If you only need “4561355507”, try this:

myNumber = System.Text.RegularExpressions.RegEx.Match(pdfText, "(?<=Number\s\w+/)\d+(?=\s\d{2}\.\d{2}\.\d{4})").Value

@berkaykor

have a look here:

As an alternate to get only the number:
grafik
grafik

Let us know your further questions

let me try this

Thank you both @ppr & @ptrobot I just need the number

myNumber = System.Text.RegularExpressions.RegEx.Match(pdfText, "(?<=Number\s\w+/)\d+(?=\s\d{2}\.\d{2}\.\d{4})").Value

this one worked

1 Like

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