Skip to content

Commit

Permalink
Update account name regex to allow starting with a number
Browse files Browse the repository at this point in the history
The beancount language specification states that:

   Each component of the account names begin with a capital letter
   or a number and are followed by letters, numbers or dash (-)
   characters. All other characters are disallowed.

The existing expression only supported accounts starting with capital
letters.
  • Loading branch information
mbrase authored and blais committed Mar 3, 2024
1 parent 546163f commit 3725c02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion beancount.el
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ from the open directive for the relevant account."

(defconst beancount-account-regexp
(concat (regexp-opt beancount-account-categories)
"\\(?::[[:upper:]][[:alnum:]-_]+\\)+")
"\\(?::[[:upper:][:digit:]][[:alnum:]-_]+\\)+")
"A regular expression to match account names.")

(defconst beancount-number-regexp "[-+]?[0-9]+\\(?:,[0-9]\\{3\\}\\)*\\(?:\\.[0-9]*\\)?"
Expand Down

0 comments on commit 3725c02

Please sign in to comment.