diff options
-rw-r--r-- | src/amount.cc | 11 | ||||
-rw-r--r-- | test/regress/2001.test | 12 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/amount.cc b/src/amount.cc index 788a140c..6baa903c 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -975,8 +975,15 @@ namespace { { char buf[256]; char c = peek_next_nonws(in); - READ_INTO(in, buf, 255, c, - std::isdigit(c) || c == '-' || c == '.' || c == ','); + int max = 255; + char *p = buf; + if (c == '-') { + *p++ = c; + max--; + in.get(c); + } + READ_INTO(in, p, max, c, + std::isdigit(c) || c == '.' || c == ','); string::size_type len = std::strlen(buf); while (len > 0 && ! std::isdigit(buf[len - 1])) { diff --git a/test/regress/2001.test b/test/regress/2001.test new file mode 100644 index 00000000..21c0fec8 --- /dev/null +++ b/test/regress/2001.test @@ -0,0 +1,12 @@ +2021/4/1 Was Already Working + Expenses:Something (3 - 1) + Assets:Cash + +2021/4/2 Now Fixed + Expenses:Something (3-1) + Assets:Cash + +test reg exp +21-Apr-01 Was Already Working Expenses:Something 2 2 +21-Apr-02 Now Fixed Expenses:Something 2 4 +end test |