summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMatus Goljer <matus.goljer@gmail.com>2015-09-21 21:21:31 +0200
committerMatus Goljer <matus.goljer@gmail.com>2015-09-21 21:21:31 +0200
commit758a224131dcc23147969aa691fb0825470253c5 (patch)
tree342b5e8169ed01f9517aef3e5c3b1994a18b82c7 /lisp
parent5f2f8e50b3a8464c58857c334ee10027693c4f78 (diff)
downloadfork-ledger-758a224131dcc23147969aa691fb0825470253c5.tar.gz
fork-ledger-758a224131dcc23147969aa691fb0825470253c5.tar.bz2
fork-ledger-758a224131dcc23147969aa691fb0825470253c5.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-regex.el4
1 files changed, 2 insertions, 2 deletions
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]*\\)?$"))