diff options
| author | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-01-26 05:45:49 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-26 05:45:49 -0600 |
| commit | bfd33a9904daac273ff2b708d02c738be276b8c7 (patch) | |
| tree | e2ff4b783ce6e856c89b779e72bc4a3eb40b9eaf /todolist/parser.go | |
| parent | 4c53c6f4755f3b50287efced0b0db7e1c6b4fa54 (diff) | |
| parent | 206a28076422758102fb7df322b218dfe4248deb (diff) | |
Merge pull request #27 from gammons/issue/proposal-expand
New Feature: Expanding existing todos
Diffstat (limited to 'todolist/parser.go')
| -rw-r--r-- | todolist/parser.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/todolist/parser.go b/todolist/parser.go index 62d864d..3ad3aae 100644 --- a/todolist/parser.go +++ b/todolist/parser.go @@ -39,6 +39,17 @@ func (p *Parser) Subject(input string) string { } } +func (p *Parser) ExpandProject(input string) string { + r, _ := regexp.Compile(`(ex|expand) +\d+ +\+\w+[^:]`) + newProject := r.FindString(input) + if len(newProject) == 0 { + return "" + } + + project := strings.Split(newProject, " ") + return project[len(project)-1] +} + func (p *Parser) Projects(input string) []string { r, _ := regexp.Compile(`\+\w+`) return p.matchWords(input, r) |
