Skip to content

Commit

Permalink
Ensuring curly braces in regexes are properly escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed Jan 8, 2019
1 parent 400b775 commit edb4496
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ It adds 5 shortcuts when editing a `Todo` file:
"todo.statistics.statusbar.priority": -1, // The priority of this item. Higher value means the item should be shown more to the left
"todo.statistics.statusbar.text": "$(check) [finished]/[all] ([percentage]%)", // Template used for rendering the text
"todo.statistics.statusbar.tooltip": "[pending] Pending - [done] Done - [cancelled] Cancelled", // Template used for rendering the tooltip
"todo.embedded.regex": "(?:<!-- *)?(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)(?:\\s*\\([^)]+\\))?:?(?!\\w)(?: *-->| *\\*/| *!}| *--}}| *}}|(?= *(?:[^:]//|/\\*+|<!--|@|--|{!|{{!--|{{!))|((?: +[^\\n@]*?)(?= *(?:[^:]//|/\\*+|<!--|@|--(?!>)|{!|{{!--|{{!))|(?: +[^@\\n]+)?))", // Regex used for finding embedded todos, requires double escaping
"todo.embedded.regex": "(?:<!-- *)?(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)(?:\\s*\\([^)]+\\))?:?(?!\\w)(?: *-->| *\\*/| *!}| *--}}| *}}|(?= *(?:[^:]//|/\\*+|<!--|@|--|\\{!|\\{\\{!--|\\{\\{!))|((?: +[^\\n@]*?)(?= *(?:[^:]//|/\\*+|<!--|@|--(?!>)|\\{!|\\{\\{!--|\\{\\{!))|(?: +[^@\\n]+)?))", // Regex used for finding embedded todos, requires double escaping
"todo.embedded.regexFlags": "gi", // Regex flags to use
"todo.embedded.include": ["**/*"], // Globs to use for including files
"todo.embedded.exclude": ["**/.*", "**/.*/**", ...], // Globs to use for excluding files
"todo.embedded.provider": "", // The provider to use when searching for embedded todos
"todo.embedded.providers.ag.regex": "(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)", // Regex used by ag, requires double escaping
"todo.embedded.providers.ag.regex": "(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)", // Regex used by ag, requires double escaping
"todo.embedded.providers.ag.args": ['--ignore-case'], // Extra arguments to pass to ag
"todo.embedded.providers.rg.regex": "(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)", // Regex used by rg, requires double escaping
"todo.embedded.providers.rg.regex": "(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)", // Regex used by rg, requires double escaping
"todo.embedded.providers.rg.args": ['--ignore-case'], // Extra arguments to pass to rg
"todo.embedded.file.wholeLine": true, // Show the whole line
"todo.embedded.file.groupByRoot": true, // Group embedded todos by workspace root
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
"todo.embedded.regex": {
"type": "string",
"description": "Regex used for finding embedded todos, requires double escaping",
"default": "(?:<!-- *)?(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)(?:\\s*\\([^)]+\\))?:?(?!\\w)(?: *-->| *\\*/| *!}| *--}}| *}}|(?= *(?:[^:]//|/\\*+|<!--|@|--|{!|{{!--|{{!))|((?: +[^\\n@]*?)(?= *(?:[^:]//|/\\*+|<!--|@|--(?!>)|{!|{{!--|{{!))|(?: +[^@\\n]+)?))"
"default": "(?:<!-- *)?(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)(?:\\s*\\([^)]+\\))?:?(?!\\w)(?: *-->| *\\*/| *!}| *--}}| *}}|(?= *(?:[^:]//|/\\*+|<!--|@|--|\\{!|\\{\\{!--|\\{\\{!))|((?: +[^\\n@]*?)(?= *(?:[^:]//|/\\*+|<!--|@|--(?!>)|\\{!|\\{\\{!--|\\{\\{!))|(?: +[^@\\n]+)?))"
},
"todo.embedded.regexFlags": {
"type": "string",
Expand Down Expand Up @@ -540,7 +540,7 @@
"todo.embedded.providers.ag.regex": {
"type": "string",
"description": "Regex used by ag, requires double escaping",
"default": "(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)"
"default": "(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)"
},
"todo.embedded.providers.ag.args": {
"type": "string",
Expand All @@ -552,7 +552,7 @@
"todo.embedded.providers.rg.regex": {
"type": "string",
"description": "Regex used by rg, requires double escaping",
"default": "(?:#|//|/\\*+|<!--|--|\\* @|{!|{{!--|{{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)"
"default": "(?:#|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE)"
},
"todo.embedded.providers.rg.args": {
"type": "string",
Expand Down

0 comments on commit edb4496

Please sign in to comment.