From 01c91130d79b8ed23443507550641ffafae1b88c Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Tue, 9 Dec 2014 16:26:51 +0000 Subject: [emacs] Parse transaction leading lines more robustly This began with noticing that the code didn't support the (ugly, yet valid) case of a tab between the date and txn description. I took the opportunity to make the regexes more consistent along the way. --- lisp/ledger-regex.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/ledger-regex.el') diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index 1ff731fc..99655716 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -338,10 +338,10 @@ )) (defconst ledger-xact-after-date-regex - (concat " ?\\([ *!]\\)" ;; mark, subexp 1 - " ?\\((.*)\\)?" ;; code, subexp 2 - " ?\\([^;\n]+\\)" ;; desc, subexp 3 - "\\(\n\\|;.*\\)" ;; comment, subexp 4 + (concat "\\([ \t]+[*!]\\)?" ;; mark, subexp 1 + "\\([ \t]+(.*?)\\)?" ;; code, subexp 2 + "\\([ \t]+[^;\n]+\\)" ;; desc, subexp 3 + "\\(;[^\n]*\\)?" ;; comment, subexp 4 )) (defconst ledger-posting-regex -- cgit v1.2.3