I've hit a wall. Does anybody know a good text editor that has search and replace like Notepad++ but can also do multi-line regex search and replace? Basically, I am trying to find something that can match a regex like:
search oldlog\(.*\n\s+([\r\n.]*)\);
replace newlog\(\1\)
Any ideas?
TextPad has good Regex search and replace capabilities; I've used it for a while and am pretty happy with it.
TextPad screenshot http://i31.tinypic.com/2bb22q.png
From the Features:
For more options than you could possibly need, check out "Notepad++ Alternatives" at AlternativeTo.net.
Notepad++ can now handle multi line regular expressions (just update to the latest version - feature was introduced around March '12).
I needed to remove all onmouseout and onmouseover statements from an HTML document and I needed to create a non-greedy multi line match.
Make sure you check the:
checkbox if you want to use the multi line match capability.you can use Python Script plugin for Multiline Regular Expression search and replace! - http://npppythonscript.sourceforge.net/docs/latest/scintilla.html?highlight=pymlreplace#Editor.pymlreplace
EditPad Pro has better regex capabilities than any other editor I've ever used.
Also, I suspect you have an error in your regex —
[\r\n.]
will match only carriage returns, newlines, and full stops. If you're trying to match any character (i.e. "dot operator plus CR and LF), try[\s\S]
instead.I use Notepad++ all the time but it's Regex has alway been a bit lacking.
Sublime Text is what you want.
The latest version of UltraEdit has multiline find and replace w/ regex support.
Or if you're OK with using a more specialized regular expression tool for this, there's Regex Hero. It has the side benefit of being able to do everything on the fly. In other words, you don't have to click a button to test your regular expression because it's automatically tested after every keypress.
Personally, I'd use UltraEdit if I'm looking to replace text in multiple files. That way I can just select the files to replace as a batch and click Replace. But if I'm working with a single text file and I'm in need of writing a more complex regular expression then I'd paste it into Regex Hero and work with it there. That's because Regex Hero can save time when you see everything happen in real-time.