Reg expression doubt

Input string-
ar abc,

This is regarding reference number 826123, the following info have been identified:

Task: 18212402 Description: 121 - gas leakage ,not completed Price: $98.50
Task: 32321720 Description: Rejected Price: $0.00
Task: 34017280 Description: 131 - This will -be repaired once spare available Price: $38.50
Task: 66017240 Description: 139 - sent for -repair Price: $16.50

Thank you,

xyz.
Email: s@a.com

I want to extraxct,whatever is after first(-) and before ‘price’, and if (-) not present then after ‘description:’ and before ‘price’.

so in above string i want— ‘gas leakage ,not completed’
Rejected
This will -be repaired once spare available
sent for -repair

I tried using or condition (?<=Description:).?(?=Price)|(?<=Description:[A-Z]).?(?=Price) ,but couldn’t get desired output.

1 Like

A post was merged into an existing topic: Regex help reqd