Skip to main content
Regexflux

TODO/FIXME Comment

beginner

Matches TODO, FIXME, HACK, and XXX comments in code.

todofixmecommentdevelopment

Pattern

/(?://|#|/\*)\s*(?:TODO|FIXME|HACK|XXX|BUG|NOTE)\b[:\s]?(.*?)(?:\*/)?$/gim

Try It

0 of 7 strings matched

Explanation

Matches common code annotation comments (TODO, FIXME, HACK, XXX, BUG, NOTE) after comment delimiters (//, #, /*). Captures the comment text.

Test Strings

Matching

  • // TODO: fix this later
  • # FIXME: broken on Windows
  • /* HACK: workaround for bug */
  • // NOTE: important detail

Non-matching

  • todo without comment marker
  • // just a normal comment
  • FIXME in prose

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /(?:\/\/|#|\/\*)\s*(?:TODO|FIXME|HACK|XXX|BUG|NOTE)\b[:\s]?(.*?)(?:\*\/)?$/gim;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);