Home » Questions » Computers [ Ask a new question ]

Editor with muti-line search and replace

Editor with muti-line search and replace

I am looking for text editor for Windows which is capable of performing search and replace operation of multi-line text block.

Asked by: Guest | Views: 344
Total answers/comments: 3
Guest [Entry]

I used Notepad++ for a while when I still had to do stuff on a Windows computer; it's got decent support for regular expressions. It's got an intuitive interface, and you won't have to memorize key combinations and shortcuts.
Guest [Entry]

"emacs

Use C-q C-j to specify a newline in the pattern to match or replace with. Plain text and regexp are supported, either all at once or in query mode (get confirmation for each match).

The functions you want are

replace-string
query-replace-string
replace-regexp
query-replace-regexp

and they can all be invoked with M-x <function name>. Some have default bindings.

Use C-h f <function-name> to learn what binding is currently assigned to any function.

To select a block from the text to use

More the point to one end of the block. Hit C-<space>.
Move the point to the other end. Hit C-w which will yank the whole block then C-y to return the yanked block or invoke copy-region-as-kill.
M-x <function> then C-y to paste the block into the search space. Newlines are handled naturally.
proceed as normal."
Guest [Entry]

"When I need multi-line search-replace I use Microsoft Word. I never use Microsoft Word as a text editor except when I need this feature. You can use ^p to search for linebreaks.

Typically I do this:

I edit a text file in my favorite text editor, but I need multi-line search-replace
Ctrl-A, Ctrl-C to select and copy all text editor
Start Microsoft Word
Ctrl-V
Search/Replace ""First line^pSecond line"" with ""New first line^pNew second line""
Ctrl-A, Ctrl-C to select and copy all from Word
Switch back to text editor
Ctrl-V to paste newly fixed-up text
Continue editing document in my favorite editor

This works for me."