HandyFile Find And Replace Online Help Submit feedback on this topic   

KB0001: I want to replace everything between */ and /* with a single line of text

Question

If I have a block such as:

*/{possibly some spaces} 
Some text 
{Blank Line} 
Some more text 
Yet more text 
{single space} 
etc 
etc for n lines 
/* 

Can I replace it with:

*/ 
Some new text 
/* 

If so what is the syntax - If I can get this to work I will buy the product.
Basically I want to able to replace everything between */ and /* with a single line of text

Answer

Our regular expression engine allows to cover almost any block of text. Let us solve your problem step by step. The best practice is to use the Regular Expression Laboratory to work out an expression that would match a block.

The following regular expression would match any text between */ and /*:

\*\/.#\/\*

In this expression:

  1. Type this expression in the Find What field.
  2. Type the text that will replace the match in the Replace With field.
  3. Check the Regular Expressions box and uncheck the Search only box.
  4. Click Replace.