Skip to content

Commit 64f705b

Browse files
author
lkramer
committed
improved regex for filtering out symbols in tags
1 parent 40db3ff commit 64f705b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func addNote(args []string) (err error) {
4747
// Arguments prefixed by + are tags
4848
if arg[0] == '+' {
4949
tag := arg[1:]
50-
if regexp.MustCompile(`^[^\W_]+$`).MatchString(tag) == false {
50+
if regexp.MustCompile(`^[\pL0-9]+$`).MatchString(tag) == false {
5151
fmt.Println("Error: Tags must be alphanumeric")
5252
return
5353
}

types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func (n Note) MatchesFilter(filter NoteFilter) (ret bool, err error) {
336336
// the single tag is skipped, but the other tags are added
337337
func (n *Note) AddTags(t []string) error {
338338
for _, v := range t {
339-
if regexp.MustCompile(`^[^\W_]+$`).MatchString(v) == false {
339+
if regexp.MustCompile(`^[\pL0-9]+$`).MatchString(v) == false {
340340
return fmt.Errorf("Error: Tags must be alphanumeric")
341341
}
342342

0 commit comments

Comments
 (0)