Regular Expression question conditional

While extracting account number from my PDF, in my regular expression I am looking for Contract No. or Account No. because some PDFs do not have Account No. instead they have Contract No. I notice some of the PDFS have both Contract No. and Account No.

How do I create a regular expression to extract Account No. if it exists, If it does not exist extract Contact No. Is using if condition only the way?

Thank you,


Please send a sample data so it can be easy to give a best advice

Hi @A_Learner

You can use both
Account No|Contact No

In your expression | this will give output as excepted

Use both values in your expression what you have just separate them with pipie symbol(|)

I tried using IsMatch with regular expression combined with if condition getting expected results. Thanks,

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