todo-tree.general.tags: Escaping Regex Characters

Created on 17 Sep 2019  ·  36Comments  ·  Source: Gruntfuggly/todo-tree

85 : There are more regex chars than the backslash...

I'm writing documentation in asciidoc an I use a asiicoc variable {todo-item}

How can I add this to tags?

  • "todo-item": there are no hits
  • "{todo-item}": regex complains "error: repetition operator missing expression"
  • "\{todo-item\}": Jsonc complains "invalid escape character in string"

Solution:
All regex characters should be escaped before building the regex search string

bug enhancement fixed

Most helpful comment

Yes, something has broken in the latest version. Will look into it.

All 36 comments

Probably your best bet in this case is to ignore the tags and just update the regex directly, e.g.

"todo-tree.regex.regex": "((//|#|<!--|;|/\\*|^)\\s*(($TAGS)|\\{todo-item\\})|^\\s*- \\[ \\])"

or if you want to keep it really simple

"todo-tree.regex.regex": "\\{todo-item\\}"

I'll see if it's possible to escape other characters...

it's a pity but it does not work for me.
\?\?\? breaks things (and \\?\\?\\? breaks all the same)

If you simplify the regex to (\?\?\?), via the GUI, or (\\?\\?\\?) in the .json, does it find anything?

"todo-tree.regex.regex": "((//|#|