Add more extensive regexp possibilities #121
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
first things first:
autopep8
in my editor. This PR as it is now includes PEP8-ing your existing code, which isn't a huge change, but mainly some line breaking and whitespace stuff. If you don't like that, I'll remove it again - but I thought maybe you don't have a problem with it, so I don't have to manually change it back. ;-)Now for the actual change: For my daily use, the functionality the current mappings provide is not sufficient. That's because my bank has one large "description" field which contains payee, description, sometimes the payee's payment info, and a reference number. What I need is a set of regular expressions that dissect the various formats that this field can come in and set payee, comment, tags etc. accordingly.
I thought about extending the current mappings file, but that didn't feel like the best solution for two reasons:
So, I added another "regexp file", which is expected to be in JSON format. From the documentation of the
read_regex_file
function:The regex file is a json file, consisting of a list of objects, each object containing:
The syntax of an entry in the file is:
There are currently four different possible actions:
If the regular expression contains any named groups, those named groups will be used to format the strings given for value. Thus, an entry like:
would set the payee of any transaction that has the string
The payee is somebody
in the second column to
somebody
.