Regex replace special comments -
so few months ago 1 of colleagues left. used comment code way:
//---------------------------- // comment //---------------------------- private void func()...
so each comment, instead of using 1 line @ most, uses 4 lines (including break line), drives me crazy. i'm trying create regex can remove comment safely , replace it. above code should way:
// comment private void func()...
i thought of removing each 1 of '//----------------------------' leaves me many empty lines break line between comment , actual line described. appreciated.
edit
note one: our project written in visual studio
note two: comments may contain more 1 line of comment, example:
//---------------------------- // line 1 comment // line 2 comment //----------------------------
this expression matches case , 3 lines of comments first , last ones have trailing -
:
((\s|\t)*\/{2,})(.*[-]+)(\r?\n)((\1(.*)\4?)+)\4\1\3\4?
and can replace with:
\5 (or $5)
edit: multi-line comments.
Comments
Post a Comment