diff options
author | Craig Earls <enderw88@gmail.com> | 2015-09-28 17:37:21 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2015-09-28 17:37:21 -0700 |
commit | 64426842a34f0517e43a47a404cd15c764f1c7f2 (patch) | |
tree | dd64c6837cb54ebef6b6de412097eb7646733aa6 /lisp/ledger-regex.el | |
parent | 4dec0e3829e0d5b9da798265cc60a3feedd57f88 (diff) | |
parent | 767ab3e39c8dd6024c0904370654e5f0a9e24b2d (diff) | |
download | fork-ledger-64426842a34f0517e43a47a404cd15c764f1c7f2.tar.gz fork-ledger-64426842a34f0517e43a47a404cd15c764f1c7f2.tar.bz2 fork-ledger-64426842a34f0517e43a47a404cd15c764f1c7f2.zip |
Merge pull request #434 from Fuco1/align-on-decimal
Align amounts on the decimal separator.
Thank you.
Diffstat (limited to 'lisp/ledger-regex.el')
-rw-r--r-- | lisp/ledger-regex.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index cf86b2f9..6ced0223 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -27,8 +27,14 @@ (defconst ledger-amount-regex (concat "\\( \\|\t\\| \t\\)[ \t]*-?" "\\([A-Z$€£₹_(]+ *\\)?" - "\\(-?[0-9,]+\\)" - "\\(\\.[0-9)]+\\)?" + ;; We either match just a number after the commodity with no + ;; decimal or thousand separators or a number with thousand + ;; separators. If we have a decimal part starting with `,' + ;; or `.', because the match is non-greedy, it must leave at + ;; least one of those symbols for the following capture + ;; group, which then finishes the decimal part. + "\\(-?\\(?:[0-9]+\\|[0-9,.]+?\\)\\)" + "\\([,.][0-9)]+\\)?" "\\( *[[:word:]€£₹_\"]+\\)?" "\\([ \t]*[@={]@?[^\n;]+?\\)?" "\\([ \t]+;.+?\\|[ \t]*\\)?$")) |