Extracting Tables data from string

I am using the pdf reader to string to extract table data, so far i had a pretty good structure and was able to extract the data using something like this (?<icn>\d{24})\s+(?<name>[\D\s,]+)\s+(?<dob>\d+\/\d+\/\d{4})\s+(?<id>\d+)\s+(?<from>\d+\/\d+\/\d{4})\s+(?<thru>\d+\/\d+\/\d{4})

and by using a for each and assigning them to variable then to a datatable. Works well

I got a slightly different format of the pdf and my regex broke and i am having a hard time with correct regex to extract these information, Below is the text and key and value, what is the best regex pattern to extract this in group

Patient ID/Name: 42500254/jay adam chacko DOB: 9/1/2005 SEX: M         Audit ID: 106659
Service From Service Thru Claim Number Patient ID Number Reference  Number Notes:
Date Date
8/13/2015 10/20/2011 100050050201627376585544 123541520 0525N Reference claim for Readmission
audit. Record and affidavit is
required for audit. Please submit
records.

Patient ID/Name: 42600254/tj adam jc DOB: 9/2/2005 SEX: M         Audit ID: 107759
Service From Service Thru Claim Number Patient ID Number Reference  Number Notes:
Date Date
8/15/2015 10/21/2011 100050050601627376585544 213541520 0625N Reference claim for Readmission
audit. Record and affidavit is
required for audit. Please submit
records.
  1. Name : jay adam chacko
    dob:09/1/2005
    Service From: 8/13/2015
    Service Thru: 10/20/2011
    claim number: 100050050201627376585544
    patient id: 123541520

2)Name : tj adam jc
dob:9/2/2005
Service From: 8/15/2015
Service Thru: 10/21/2011
claim number: 100050050601627376585544
patient id: 213541520

Hello,

Check this regex expression:

ID\/Name: (?<id>\d{8})\/(?<name>.+) DOB: (?<dob>.+) SEX.*\n.*\n.*\n(?<service_from>[\w\/]+)\s(?<service_thru>[\w\/]+)\s(?<claim_number>[\d]+)\s(?<patient_id>[\d]+)

Best,
Charbel

1 Like

nice , this worked perfectly. thanks

Always welcome!

Feel free to tag me if you have any other questions.

1 Like

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