From 758a224131dcc23147969aa691fb0825470253c5 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Mon, 21 Sep 2015 21:21:31 +0200 Subject: Fix amount-regex to properly capture integer part. If the integer part was 2 digits, because the integer part was non-greedy, it only captured as much as necessary, namely one digit. The other digit was captured by the 5th group's [:word:] not 4th because that one is also optional. This results in incorrect reporting of amount length and broken aligning. Also move the decimal dot matching from 3rd group to 4th, and quote the dot. --- lisp/ledger-regex.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index 5d525d95..cf86b2f9 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -27,8 +27,8 @@ (defconst ledger-amount-regex (concat "\\( \\|\t\\| \t\\)[ \t]*-?" "\\([A-Z$€£₹_(]+ *\\)?" - "\\(-?[0-9,\\.]+?\\)" - "\\(.[0-9)]+\\)?" + "\\(-?[0-9,]+\\)" + "\\(\\.[0-9)]+\\)?" "\\( *[[:word:]€£₹_\"]+\\)?" "\\([ \t]*[@={]@?[^\n;]+?\\)?" "\\([ \t]+;.+?\\|[ \t]*\\)?$")) -- cgit v1.2.3