I have a string and want the last digit occurrence (for now my string.match only take the first occurrence)
testvar = "350.11$ i paid, 320$, with visa, cash, 200.21, mastercard, shopping, food"
print ("last number: ".. string.match (testvar, "(%d*%.?%d+)"))
in that case I want 200.21 as result (and not 350.11 as by now)
string.match (testvar:reverse(), "(%d+%.?%d*)"):reverse()- Egor Skriptunoffstring.match (testvar, ".*%f[%d.](%d*%.?%d+)")- Egor Skriptunoffreverse()trick. However, it should be noted that it will work only when the pattern happens to be symmetric (a palindrome if you will). The given pattern, for example, while it will match the number.100when going forward it will fail to match correctly withreverse()- tonypdmtr