Need to Extractor Amount in below text using REGEX

Inpatient Facility
In-Network: 100% of the allowed amount subject to a $200 per admission deductible (applies to OOP) a $25.00 per day copay for days 2 through 5 (applies to OOP), preadmission certification is required.
Out-of-Network: (In-State) - Non-Covered
Out-of-Network: (All Else) - 80% of the allowed amount (coinsurance does not apply to OOP) subject to a $200 per admission deductible (does not apply to OOP) a $25.00 per day copay for days 2 through 5 (does not apply to OOP), preadm

In above text i need to extract $25.00 per day
Keyword is In-Network and before Copay need to extract when In-Network is present can you please give REGEX expression


Is " per day" fixed string? If so, the following will work.

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=In-Network:[\s\S]+?)\$[\d.,]+ per day(?=[\s\S]+?copay)",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value


Hello @Vicky_K ,
Try this one


I need to extract 25 if perday is not in there also


How about the following?



1 Like

@Vicky_K Try this


Output —> $25

System.Text.RegularExpressions.Regex.Match(SampStr,"(?<=In-Network\W.*?)\$\d{1,5}.\d{2}[\sA-Za-z]+(?=.*?copay)").ToString.Trim  -----> $25 per day

Output —> $25 per day

1 Like

Thanks @Yoichi

Thank you so much @Gokul_Jayakumar
Guide me how to learn REGEX

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