I have a string with the following value:
TOTAL DUE-STATEMENT$240.05911 Fee$10.00FRANCHISE TAX$.172VSALES TAX$.53LOCAL-TAX$.23SERVICE DISCOUNT-$50.00PAYMENT - THANK YOU-$100.00HBO+STARLET$100.00
I need to split this string as a key/value pair.
TOTAL DUE-STATEMENT $240.05
911 Fee $10.00
FRANCHISE TAX $.17
2VSALES TAX $.53
LOCAL-TAX $.23
SERVICE DISCOUNT -$50.00
PAYMENT - THANK YOU -$100.00
HBO+STARLET $100.00
My String value will be always dynamic and the description is dynamic except 911 Fee
I wrote a regex as follows.
([911 a-zA-Z |911 a-zA-Z|a-zA-Z |a-zA-Z \\-? a-zA-Z|! ?|+? ]+)(-?\\$[0-9|,]*\\.[0-9][0-9])
I am getting the key/value pairs correctly, except the description contains numerals and letters and special characters. My output is as follows:
TOTAL DUE-STATEMENT $240.05
911 Fee $10.00
FRANCHISE TAX $.17
SALES TAX $.53 ** Which is wrong**(Expected is 2VSALES TAX as key)
LOCAL-TAX $.23
SERVICE DISCOUNT -$50.00
PAYMENT - THANK YOU- $100.00 "-" is coming as key (Expected is PAYMENT - THANK YOU)
STARLET $100.00 **- Which is wrong** (Expected is HBO+STARLET)
Could some one please help me what I need to change in this regex?
