So you have a block of text that you want to replace and it has more than one line.
HTML-Kit Tools : Finding and replacing multi-line text in the current document
Let's start with the quick solution. If you're using HTML-Kit Tools, one of the options on "Edit > Replace" menu is a dialog for finding and replacing multi-line text. Simply paste or enter the text you're looking for and start replacing.
HTML-Kit Tools : Finding and replacing multi-line text in multiple files
Multi-line support is also in batch find and batch replace functions in HTML-Kit Tools:
- Open a project from "File > Projects" menu
- Inside the project window, select a folder where you'd like to start searching
- Right click (the selected folder), and pick "Batch Actions > Find in Files" from the pop-up menu
- You'll see a find field that allows for multiple lines
That's HTML-Kit Tools, which had the luxury of following HTML-Kit 292 and learning the few things along the way.
HTML-Kit 292 : Finding and replacing multi-line text in the current document
Finding (and replacing) mult-line text is a little tricky in HTML-Kit 292, but not impossible.
To find a block of text in the current document:
- Press Ctrl+F
- Click "..." next to the "Find what" field
- Paste or enter multi-line text, and click OK
- Click "Find Next" to start searching
That wasn't too bad, was it?
HTML-Kit 292 : Finding multi-line text in multiple files
Let's try searching for a block of text, with many lines, in multiple files and folders:
- If you haven't already, install Ciaran's excellent cmBatchFind plugin. This adds batch search capability to HTML-Kit 292.
- Select "Actions > Batch Actions > Find Text" from the main menu
As you see, the "Search Expression" field only accepts a single line of text. It is however possible to convert a block of text into a single-line regex expression and use that as the search expression. Or, you can use the following multi-line text to single-line regex converter:
When working with the cmBatchFind plugin:
- Copy the single-line regular expression you've generated for the find text, and paste it in "Search Expression" field.
- Add "r" (without quotes) to "Options" field.
- Finally, click "Start" to begin batch search.
HTML-Kit 292 : Replacing multi-line text in multiple files
The Search Expression generated above also works with cmBatchReplace plugin. However, the "Replace With" text has to be formatted to include new lines and escape "\" characters. Here's a converter for generating a single-line "Replace With" text:
When working with the cmBatchReplace plugin:
- Copy the single-line regular expression you've generated for the find text, and paste it in "Search Expression" field.
- Copy the single-line replace text you've generated, and paste it in "Replace With" field.
- Add "r" (without quotes) to "Options" field.
- Finally, click "Start" to begin batch replace.