Extracting Pan Card holder name using regex

I want to extract name from pan card using regex and i have used [A-Z]+ regex but it extracts all uppercase words from pan card and i need only name Could anyone please help me with this issue?

Hi @Seema_Jethe

You can give regax to match “The Name before or after certain keyword”


Hi @Seema_Jethe

This is something i already share one.

Thank you

@Sudharsan_Ka but the words before and after the name are not always fixed

@Jobin_Joy yes i tried this for pan card number but now i need for pan card holder’s name

Oops got it. My Bad :slight_smile:

Can you give a sample text for PAN card holder name extraction? So that it will be useful to frame a pattern for regular expression.

Thank you.

@Jobin_Joy MONIKA MAHADEV SHINDE i want to extract this using regex

Extract a line from the extracted test it should be 1st line then you will get only name

@Divyanshu_Divyanshu But sometimes the name appears in first line and sometimes in some other line Could u please help me with this issue?
Below are the screenshots

The main Problem I am seeing here is, How will you differentiate between Name and Father’s Name (As there is no identifier).

It can be extracted from the part of image, As Name will always be in fixed position in the Pan Card

1 Like

@Santan_Barnwal but how to extract it from part of image?


In order to build a Regex pattern we need:

  • Samples (copy paste into forums is best)
  • Expected Output
  • Information on the pattern - what is consistent.

Once you are able to provide this the community can provide a robust working Regex Pattern :slight_smile:

Hi @Seema_Jethe

Try this way


Thank you

@Jobin_Joy but will it work for all pancards?

It will work for PAN cards with same layout.

@Jobin_Joy Pan cards with same layout as in the position of name is always fixed?

Hi @Seema_Jethe

Here is the solution I am thinking about.

Assume the that you are receiving PAN cards with 3 different categories and place the PAN cards in respective folder.

Step 1. Loop through each file in each folder.
Ex: Folder:PAN_CAT1->Pan1.jpg,Pan2.jpg then Folder:PAN_CAT2->Pan1.jpg,Pan2.jpg

Step 2: Implement separate xaml for each category and make use of the ‘Get OCR Text’ extract the PAN card holder name from the specific position. OR Read the entire data and apply a regular expression pattern for that specific category to get the same PAN card holder name


Hope this will be helpful. Thank you.