quentinsf / icsv2ledger

Interactive importing of CSV files to Ledger
196 stars 70 forks source link

Mapping Regex is not matching #85

Open briviere opened 9 years ago

briviere commented 9 years ago

If the pattern you are try to match is at the start of the string then it will match otherwise it will not find an match

Patten: /TFR-TO 1234456/

Desciption to check for match: "WU-005 TFR-TO 123456"

will not work unless I change the match code to search as follows:

            if m[0].search(entry.desc, 0):
                payee, account, tags = m[1], m[2], m[3]
                found = True

thanks

Brian

kalafut commented 8 years ago

Brian,

Just change your pattern to /.*TFR-TO 123456/ and it will work. You have to match from the beginning of the string onward, so the modified regex just consumes any number of leading characters and will perform the same as search().

Jim