summaryrefslogtreecommitdiff
path: root/lisp/ledger-regex.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2015-09-28 19:00:01 -0700
committerCraig Earls <enderw88@gmail.com>2015-09-28 19:00:01 -0700
commit1cf83c6f5f5d005fb143f34b32b86bb838cd9674 (patch)
treee63e21895b68c44f7672569a32cf8324cc0ab70f /lisp/ledger-regex.el
parent5905c21ded741a9d17f67999a7e4c33da6c886c8 (diff)
parent64426842a34f0517e43a47a404cd15c764f1c7f2 (diff)
downloadledger-1cf83c6f5f5d005fb143f34b32b86bb838cd9674.tar.gz
ledger-1cf83c6f5f5d005fb143f34b32b86bb838cd9674.tar.bz2
ledger-1cf83c6f5f5d005fb143f34b32b86bb838cd9674.zip
Merge commit '64426842a34f0517e43a47a404cd15c764f1c7f2' into next
Diffstat (limited to 'lisp/ledger-regex.el')
-rw-r--r--lisp/ledger-regex.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el
index 5d525d95..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]*\\)?$"))