4

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?

3 Answers 3

8

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

/\*.*?\*/
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

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!

3 Comments

This is JD-GUI's output, the simplest of regex will do :)
With regex, simple is always better, when the situation allows ;)
Yes, and in this particular circumstance, since you are running the regex against a generated source code file, there's no other, useful comments you need to worry about.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.