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

Hi,

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

Regards,

Hello @Vicky_K ,
Try this one

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=In-Network\W.*?)[$\d.]+\sper\sday").ToString.Trim

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

HI,

How about the following?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=In-Network:[\s\S]+?)\$[\d.,]+[\sA-Za-z]*?(?=\scopay)",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value

Regards,

1 Like

@Vicky_K Try this

System.Text.RegularExpressions.Regex.Match(SampStr,"(?<=In-Network\W.*?)\$\d{1,5}.\d{2}(?=.*?copay)").ToString.Trim 

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.