3

I have some classes that contains comments like as follow:

...
...
...
/*     */ 
/*     */   public void startApplication()
/*     */   {
/*  57 */     initializeFields();
/*  58 */     this.run = true;
/*  59 */     new Thread(this).start();
/*     */   }
/*     */ 
/*     */   public void stopApplication() {
/*  63 */     this.run = false;
/*     */   }
/*     */ 
/*     */   public void run()
/*     */   {
...
...
...

And i have to clean all /* */ strings in my classes. Which regex should i use to do this with using Eclipse's Find/Replace tool?

Oguz Ozkeroglu
  • 3,025
  • 3
  • 38
  • 64

3 Answers3

7

This is Jd-GUi, I've already needed the same regex :)

/\*.*?\*/
Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
1

Hit CTRL+SPACE on the text boxes it will give you suggestions for regular expressions. You can fin more details in this discussion

Community
  • 1
  • 1
Mehdi
  • 1,494
  • 5
  • 33
  • 53
0

You can use: /\*\s+\d*\s+\*/, or if you also want to strip the space before the code, presuming it's a tab, use /\*\s+\d*\s+\*/\t. Optionally change that last tab for a specific number of spaces - if you just use \s+, for instance, it will lose your indentation, which you don't want!

LeonardChallis
  • 7,759
  • 6
  • 45
  • 76