diff options
| author | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-08-20 23:04:29 +0800 |
|---|---|---|
| committer | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-08-20 23:04:29 +0800 |
| commit | f9a98c7aa2d92b931c2ce34d188d9be390f4e2dc (patch) | |
| tree | f273558f7f8719a03066ec396eb79cf2a0aa2168 | |
| parent | 620a9f3aff090063f79285fb20437a62ce089a4e (diff) | |
Fix a bug in ParseNewTodo()
The new pattern now does not allow empty todos to be added as "a"
or "add" strings.
| -rw-r--r-- | todolist/parser.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/todolist/parser.go b/todolist/parser.go index cdfb179..d62c77d 100644 --- a/todolist/parser.go +++ b/todolist/parser.go @@ -12,7 +12,7 @@ import ( type Parser struct{} func (p *Parser) ParseNewTodo(input string) *Todo { - r, _ := regexp.Compile(`^(add|a)(\\ |) `) + r, _ := regexp.Compile(`^(add|a)(\s*|)`) input = r.ReplaceAllString(input, "") if input == "" { return nil |
