perl - replace string1 with string2 in many java files, only in comments -
i have around 3000 instance of replacement done in hundreds of files. replacing occurance of string1 string2 easy. intellij allows me replace occurences in "comments , strings".
the problem same string appear in comments , real code. restrict replacement in comment section ( use mix of /**/ or // )
any library/ide/script can this?
use regexp::common 'comment'; ... s/($re{comment}{'c++'})/(my $x = $1) =~ s#string1#string2#g; $x/ge;
Comments
Post a Comment