SilverAge Software

Search and Replace. Edit. Transform.

Use Cases

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 will 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. For example: */Some new text/*.
    To insert multiple lines of text, use the multiline editor by clicking the Replace With button.
  3. Check the Regular Expressions box and uncheck the Force search only box.
  4. Click Replace.