I used this ((?=(?!\bTODO\b)*?;).*)((?=.*?\bTODO\b).*)[^\n] regex to look for TODO inside commented text, its valid javascript regex, see this demo
But when I use
editor.getModel().findMatches("((?=(?!\\bTODO\\b)*?;).*)((?=.*?\\bTODO\\b).*)[^\\s]", true, true, true, null, true);
it returns empty FindMatch[]. Removing negative-lookahead ((?=.*?;).*)((?=.*?\bTODO\b).*)[^\n] it behave correctly, but it match invalid lines, obviously.
It is bug of monaco-editor, or just I do something wrong?
You can use
See the regex demo.
Details
(;.*)- Group 1: a;and then any zero or more chars other than line break chars, as many as possible(\bTODO\b.*)-TODOas a whole word and then any zero or more chars other than line break chars, as many as possible.