Doing a lot of regular expression search and replacements can be a hassle sometimes. I've found that a tool on macOS called "Better Rename" does a fantastic at showing a preview / live view of what is selected and then the result of the replacement: alt

Is there an editor on macOS that gives a similar style of having multiple panes to show the regex matches and the resultant replacements that will be made?

So far the closest thing I've found so far is in Sublime Text where it gives a preview of the selection of a regex, but not the change / replace function...


I use this: RegExRX

And since a picture is worth a 210 words, so:

Search Replace

  • I like the visual clarity of this. I sure do wish it was in the actual text editor that's editing the file though vs having to paste in sample text. – ylluminate Jun 24 '17 at 15:25

As is often the case in text editing, The One True Editor Emacs has a package for doing this. See this SO post about doing the very same thing in Emacs. Here are links to the relevant packages:

The second one allows usage of regexp engines other than Emacs' own regexp engine, which has some differences when compared to, for example, PCRE. To install these packages, add the MELPA package repository to your package-archives variable (in Spacemacs this is done by default), then do M-x package-install visual-regexp & M-x package-install visual-regexp-steroids.

  • That's really slick. A screencast of this setup and usage with key presses would be fantastic. I wish it was a little more visual in the sense of seeing a columnar view like a diff; left: original+match and right: resultant output of replacement; both colorized for visual clarity. – ylluminate Jun 24 '17 at 15:24

Almost every JetBrain product does have a live preview (grey box)

enter image description here

Of course there is (as you mentioned) SublimeText

If you can live without a graphical user interface you can use sed

  • Huh, that's really interesting. It might even be better to show it in reverse, but this is quite nice. – ylluminate Jun 28 '17 at 15:27
  • I did not do this since you were only talking about GUI's in your question ;) – holzkohlengrill Jun 29 '17 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.