Regex matching help

Hi, I am trying to get the data after Last PAY Amount up to Adjustments.
The following regex not doing it. Can you help please? Many thanks,

(?<=EMPLOYEE\s)[.*[\n]]+(?=^(?:Adjustments))

EMPLOYEE NUMBER CYCLE PAY DATE RECEIVED DATE Last PAY Amount 62379.25
123456-7891234 10-03 4/12/2023 6/04/2023 Payments -12123.73
Adjustments 0.00
Rate Class: Balance Forward 0.00

Hi @A_Learner

Try this

(?<=Last PAY Amount\s)[\s\S]*(?=Adjustments)

I hope it helps!!

1 Like

Hi @A_Learner
Try this
(?<=Last PAY Amount\s)[\s\S]*?(?=^(?:Adjustments))

Hi @A_Learner

Try this

(?<=Last PAY Amount\s)[\s\S]*(?=Adjustments)

I hope it helps!!

Hi @A_Learner

Check the below regular expressions

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“((?<=Last PAY Amount\s*).*\n+.*)”)

Explanation -
(?<=Last PAY Amount\s*) → Look a head which looks after this text
.* → Matches any character which of 0 or more
\n+ → Will move to next line
.* → Matches any character which of 0 or more

Hope it helps!!

Hi @A_Learner

(?i)Last PAY Amount\s+([\d.]+)(?:(?!\sAdjustments)[\s\S])

Hope it helps!.

@A_Learner

Try the below regex expression

System.Text.RegularExpressions.Regex.Matches(yourinputvariable.ToString,"(?<=Last PAY Amount\s).*\s+.*(?=\nAdjustments)")

Thankyou, @lrtetala

Many Thanks every one for all the good solutions.
I picked the simpler one of all. Thanks again!

1 Like

Thankyou, @lrtetala

Many Thanks @ for all the good solutions.
I picked the simpler one of all. Thanks again!

1 Like

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