Extract part of variable?

I am using this to extract page number from Preview.
Using %FrontWindowName% as source. Gives "PDF Name.pdf - (page x of y)"

I am able to extract Page number using:


Now I don't know how to extract PDF name using regex.

Pardon my lack of programming skills. :slight_smile:

Thanks a lot.


better solution below

Maybe you made a typo when posting, but that has a syntax error. Even when corrected would not match a multi-digit page number.

This works for me:
(.+)\.pdf.+page (\d+)

Which matches:
PDF Name.pdf - (page 123 of 456)

1 Like

Thanks. Didn't think of that.