NOW ON SALE: Save $80 on UltraSuite! Offer ends in 00:00

Home » Support » Tutorials/Power Tips » UltraEdit » Multiline find and replace

IDM PowerTips

Multiline find and replace

Note: As of UltraEdit v14.00 and UEStudio v06.50, multiline find and replace is natively supported. Simply press CTRL + ENTER to insert a carriage return/line feed into the Find What or Replace With dialogs.

A powerful feature of UltraEdit and UEStudio is their wide range of find/replace features. You can find a string of text in a file, in multiple files, all open files, project files, throughout a directory and its sub-directories, and more. Not only can you perform a find but also a replace. Oh, and did we mention it supports regular expressions? But that's another subject... (learn about regular expressions)

What happens if the text you need to find/replace spans multiple lines? No problem... You've come to the right place.

Multi-Line Find and Replace

Step 1: Variables

For a multi-line Find/Replace you can use "^p" as the CR/LF (line terminator) as it is translated to a hard return.

You can also use the contents of the clipboard or selected text in a search or replace string with "^c" and "^s" respectively.

UltraEdit and UEStudio support the following variables in the Find/Replace dialogs:

Symbol Function
^^ searches for a "^" character
^s searches for selected (highlighted) text when a macro is running
^c searches for the contents of the clipboard when a macro is running
^b matches a page break
^p matches a newline (CR/LF) (paragraph) (DOS Files)
^r matches a newline (CR Only) (paragraph) (MAC Files)
^n matches a newline (LF Only) (paragraph) (UNIX Files)
^t matches a tab character

Additional information regarding Find/Replace and Find/Replace in Files is available in the Help File.

Step 2: Perform the Replace

For this example, we are going to use "^s" and "^c" for our Replace. We are going to replace the text that is selected, in the edit window, and replace it with the contents of the clipboard.

Select the text you would like to use as your "Replace With" text and copy it to the clipboard. We have selected and copied the highlighted text below.

Multi-Line Find and Replace

Select the text which you would like replaced.

Multi-Line Find and Replace

Open the Replace dialog from the Search menu. You should see that the selected text has populated the "Find What" field. You can leave this here rather than using the ^s, however for this example we are using the variables.

Type "^s" and "^c" in the appropriate Find What and Replace With fields.

Multi-Line Find and Replace

Click on Replace All and you should see your "Find What" (selected text) replaced with your "Replace With" (clipboard text).

Multi-Line Find and Replace