Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(/\*[\s\S]*?\*/|\/\/.*?$|\/\/.*?\n)*(#ifdef BUILD_FLAG\r?\n(?:.*\r?\n)*?#endif\r?\n)
"
gm
Input 1
1
New
Code here and here //this is s comment block /** *and a nested comment block */ //----------------------------------------------------------------------------- // this comment block should not be captured //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // this whole comment block and the conditional block below should be captured //----------------------------------------------------------------------------- /** * @brief Some comment * * * @return */ //----------------------------------------------------------------------------- #ifdef BUILD_FLAG ... #endif More code More code //--------------------------------------------------------- // this whole comment block and the conditional block below should be captured // -------------------------------------------------------- #ifdef BUILD_FLAG ... #endif More code //------------------------------------------------------------------------- /** * @name this whole block comment should be captured. * @{ */ #ifdef BUILD_FLAG ... #endif
Substitution