summaryrefslogtreecommitdiff
path: root/lisp/ldg-regex.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ldg-regex.el')
-rw-r--r--lisp/ldg-regex.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el
index 226475df..83bc2197 100644
--- a/lisp/ldg-regex.el
+++ b/lisp/ldg-regex.el
@@ -43,7 +43,7 @@
"\\(^[~=A-Za-z].+\\)+")
(defconst ledger-comment-regex
- "\\( \\| \\|^\\)\\(;.*\\)")
+ "^[;#|\\*%].*\\|[ \t]+;.*")
(defconst ledger-payee-any-status-regex
"^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)")
@@ -61,13 +61,22 @@
"^--.+?\\($\\|[ ]\\)")
(defconst ledger-account-any-status-regex
- "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?.+?\\)\\(\t\\|\n\\| [ \t]\\)")
+ "^[ \t]+\\(?1:[*!]\\s-*\\)?\\(?2:[^ ;].*?\\)\\( \\|\t\\|$\\)")
(defconst ledger-account-pending-regex
- "\\(^[ \t]+\\)\\(!.+?\\)\\( \\|$\\)")
+ "\\(^[ \t]+\\)\\(!\\s-*.*?\\)\\( \\|\t\\|$\\)")
(defconst ledger-account-cleared-regex
- "\\(^[ \t]+\\)\\(\\*.+?\\)\\( \\|$\\)")
+ "\\(^[ \t]+\\)\\(*\\s-*.*?\\)\\( \\|\t\\|$\\)")
+
+(defconst ledger-metadata-regex
+ "[ \t]+\\(?2:;[ \t]+.+\\)$")
+
+(defconst ledger-account-or-metadata-regex
+ (concat
+ ledger-account-any-status-regex
+ "\\|"
+ ledger-metadata-regex))