When using eclipse, finding replacements may be a tool we often use, but most of them simply look for replacements for simple word text (such as finding replacement warnings), but in complex situations, most people may manually change.
For example:
/* */Public class configuration/* */{/*/ Private list<context> contexts;/* * / Private list<string> classpathentries;/* */* * * public Configuration ( ) /*/*/* * * * this.contexts = new ArrayList ();/* */ this.classpathentries = new ArrayList ();/* * }/* *//* * /public void Addclasspathentry (String entry) {/* * * * This.classPathEntries.add (entry);/* * */ }/* */}</context>
When we encounter the above code, we can easily replace the "/* * * * * * * * * * * * * * * *, but cannot replace the comment like"/* 41 * * ".
In fact, Eclipse's find-and-replace tool supports regular Expressions ,
Tick "Regular expressions", that is, switch to "regular expression" mode.
In the Find Input box, type:/\* (\s|\w) * \*/
You can then replace all of the "/* * * * * * * * * * * *and the comments with the number in the middle.
Again, for example, match the string with the <title> start </title> end:<title>.*?</title>
Match HTML or XML tags:< (\s+) (((\s[^<>]*)?\/>) | ( \s[^>]*)?>[\s\s]*?<\/\1\s*>)
We know that after the lookup substitution supports regular expressions, many query matches can be implemented, but it is important to be cautious about fuzzy matching, or the wrong substitution will cause problems.
Eclipse Find and replace smart tricks usage