regex - Search and replace strings in Java source files using Emacs and regular expressions -
suppose had java file contained lots of single letter variable names a,x,f etc, , wanted change them more meaningful. try replacing every occurrence of ‘f’ ‘filename’, mess of places ‘f’ occurs inside word (for example in keyword if ). how go correcting problem using regular expression search , replace?
i need write in emacs, using word boundaries. since new, using matcher class apply?
if must using native emacs: word boundaries reasonable search boundary. matcher class java construct. if writing code search , replace. since doing in emacs, wouldn't apply.
there caveat these variables can't used multiple source files or mess things up.
i wouldn't raw emacs though. i'd use ide refactoring tool. emacs has java refactoring can install. using refactoring tool, tool understands syntax , more specific regular expression.
Comments
Post a Comment