Hello @haitt2102, and All,
Your regex is quite correct but ONLY IF the [COMMENT.....] area of chars belongs to an unique line, as in the first two occurrences of your example !
So, you must use the (?s) modifier syntax to be sure that the dot regex meta-charaqcter match any single char ( standard or EOL chars ) in order that a match may be spread out on several lines !
Thus, this regex S/R should work :
SEARCH (?s)\[.+?\]
REPLACE Leave EMPTY
If your text may also content square bracket(s) as normal characters, the regex, below, will be more restrictive :
SEARCH (?s-i)\[COMMENT.+?\]
Note that I added the (?-i) modifier ( meaning no-insensitive ), to be sure that the regex engine will search for the uppercase string COMMENT
Remarks :
The (?s) or (?-s) has higher priority than the . matches newline option of the Find/Replace dialog. Idem for the (?i) or (?-i) modifiers, regarding the Match case option
Notice, also, that the (?s)\[.+?\] regex, could be replaced with the \[(.|\R)+?\] regex, which matches exactly the same occurrences, as \R match any kind of new-line characters !
Cheers,
guy038