I am trying to write a regular expression that will search based on a string and if it founds even a partial match. I can get extract numbers from lines (2 lines) above and below the matched string or substring.
My text is:
Subtotal AED1,232.20
AED61.61
VAT
5 % Tax:
RECEIPT TOTAL: AED1.293.81
I wish to search for the word VAT and extract all numbers from two lines above and below it.
Expected output:
AED1,232.20
AED61.61
5 %
AED1.293.81
I am able to extract the entire content but I need the numbers, AED can be dropped or ignored.
My regex is:
((.*\n){2}).*vat(.*\n.*\n.*)
Thanks in advance!