Hi, I am working with an unstructured pdf. I can get the text of a page as string. Now I need to get the number before the keyword “invoice”, e.g.: 2x invoice → 2. The keyword is unique and there is always an “x” but I don’t have other elements to use. How would I do that best? Thanks a lot.
Thanks, that looks good. How can I assign it to a new string variable?
I have NumberVar=Regex.Matches(stringVar,“(\d+)x invoice”) but it doesn’t work yet.
Thanks, I’m almost there now. The thing is that I need only the number before the word “invoice”. If the string has another number with x before it should be ignored (e.g. 3x flyer → ignored).
Edit: @Nitesh I know that it’s similar to the thing I asked yesterday but I didn’t find a tutorial how to use it with a keyword.
I would like to have it this way: regex101: build, test, and debug regex
@Jizh correct me if i am wrong. you needs to get only number before invoice
example afhjfaksdj 11x flyer asdfhkjdf 22x invoice sdfafs
from the above string you needs to get only 22 right know?
Yes exactly, sorry for being unprecise.
Hi @Jizh
Can you for example use the workflow submitted by @indra, where you place your regex in Assign to get the string with the number followed by “x invoice”, then split the string using “x” as a separator and later take the first part of that split string (which as a result is going to be your number)?
Does it solve your problem?

Thanks for the reply PAD.
I looked a bit further into Regex and I think I found another way if anyone is interested:
(\d+)(?=x invoice) → this gives just the number
Yes, that’s another way to do it
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.