Getting Text till the Next "Empty Line" ? Regex

This is my regex to extract some tabular like data i got from read pdf, so i can read regex in group.

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

This is test/dummy data

Patient ID/Name: 413245024/jaisil babu john DOB: 5/18/2006 SEX: F         Audit ID: 455502
Service From Service Thru Claim Number Patient ID Number Reference  Number Notes:
Date Date
10/16/2016 12/1/2016 100040040510029008994506 612947999 22J3h8 Reference claim for Readmission
audit. Record and affidavit is
required for audit. Please submit
records.

Patient ID/Name: 512947666/john janu, baby DOB: 5/15/2002 SEX: F         Audit ID: 555207
Service From Service Thru Claim Number Patient ID Number Reference  Number Notes:
Date Date
10/26/2019 10/28/2019 200040050502003049505555 410947333 01JL2Y Claim for audit, please send
Medical Records.

Issue is i am not able to get the full “table_notes” from the regex (last regex after table_ref_num)

so instead of “Reference claim for Readmission
audit. Record and affidavit is
required for audit. Please submit
records.” i only got upto “Reference claim for Readmission” and the second item instead of “laim for audit, please send
Medical Records.” i am getting only “Claim for audit, please send”.

So basically need the last regex to say get me everything up to when there is a new line.

Hi,

How about the following pattern?

ID\/Name: (?<id>\d{9})\/(?<name>.+) DOB: (?<dob>.+) SEX.*\n.*\n.*\n(?<service_from>[\w\/]+)\s(?<service_thru>[\w\/]+)\s(?<claim_number>[\d{24}]+)\s(?<patient_id>[\d]+)\s(?<table_ref_num>.{6})\s+(?<table_notes>[\s\S]*?)(?=(\r?\n){2,}|\s*$)

Regards,

1 Like

thanks this works

1 Like

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