aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-20 23:04:29 +0800
committerQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-20 23:04:29 +0800
commitf9a98c7aa2d92b931c2ce34d188d9be390f4e2dc (patch)
treef273558f7f8719a03066ec396eb79cf2a0aa2168 /todolist/parser.go
parent620a9f3aff090063f79285fb20437a62ce089a4e (diff)
Fix a bug in ParseNewTodo()
The new pattern now does not allow empty todos to be added as "a" or "add" strings.
Diffstat (limited to 'todolist/parser.go')
-rw-r--r--todolist/parser.go2
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