In the following lines how to write regular expression to find whether a line startswith currency or ends with currency
line = ["$20 is your bill",
"this is your bill",
"bill amount is $30",
"$40 or $50"]
for l in line:
matchObj = re.search( r'\$[\d.]+', l, re.M|re.I)
How to check if a line starts or ends with a currency?
seems to be working for me.
This won’t work if the currency isn’t an integer value, though.