getting-things-gnome/gtg

Inconsistent rules for tag names

gycsaba96 opened this issue · 0 comments

There are multiple regular expressions in the source code related to tags. Unfortunately, they have a different idea about valid tag names:

  1. GTG/core/tasks.py: TAG_REGEX = re.compile(r'^\B\@\w+(\-\w+)*\,*')
  2. GTG/gtk/editor/taskview.py: TAG_REGEX = re.compile(r'(?<!\/|\w)\@\w+(\.*[\-\w+\+\%\$\\(\)\[\]\{\}\^\=\/\*])*')
  3. GTG/backends/backend_caldav.py: TAG_REGEX = re.compile(r'\B@\w+[-_()\w]*')

For example, the task editor (2.) recognizes the following lines as tags, but the other two does not:

@r^{2}x(3.14)
@a$(){}
@a^2+b^2=c^2
@_.-._

The first definition is probably the most reasonable and the easiest to handle. However, it might not be that simple based on PR #875.