SilverAge Software
Search And Replace. For Windows.
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:
\*\/designates the start of the block. We use regular expressions therefore we have to escape non-alphanumeric symbols..#is an expression that will match any symbol until the first occurence of /* is found. A dot means any character, and # means "continue previous match 1 or more times until the first occurrence of the next condition".\/\*designates the end of the block.
- Type this expression in the Find What field.
- 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. - Check the Regular Expressions box and uncheck the Force search only box.
- Click Replace.