Search

regexxer: search/replace for the masses

March 29th, 2009 edited by Vicho

Article submitted by David A. Thompson. Guess what? We still need you to submit good articles about software you like!

This thing is great! If you manage a set of files (e.g., a code base) and end up needing to perform a search/replace across the files, or some subset thereof, maybe regexxer will end up being counted among your friends.

The regexxer web site summarizes regexxer as “a nifty GUI search/replace tool featuring Perl-style regular expressions”. After using regexxer, I have to agree…

If you have a code base that needs some search/replace time spent on it, regexxer really does seem to be the way to go. Again, the web site sums things up well: “If you need project-wide substitution and you’re tired of hacking sed command lines together, then you should definitely give it a try.”

The GUI

regexxer main windowThe regexxer GUI is a straightforward, logically organized window with file management on the left and search/replace management on the right. The beauty of the thing is that the author(s?) seem to have added a lot of flexibility to the search/replace process while keeping the user interface relatively simple and clean.

File Management

One can select one or many files from a given folder. Recursion is optional and a pattern (e.g., *.lisp) can be defined to further limit files being acted on. A ‘find’ button then triggers execution of the search and the corresponding files are shown in the window below. Not much more to say…

The Search Replace process

The user interface makes it easy on the noggin with top-to-bottom arrangement of controls which follow the logic of the search replace. The perl-style search regex and the corresponding replacement are entered at the top of the window. Another ‘find’ button triggers the search and the corresponding matches are shown in context in the window below. At this point, I found the regexxer user interface close to ideal. The flexibility available to the user includes:

  • ‘On the fly’ editing of the file.
  • Performing the replace action one-at-a-time or per file or upon all files as a unit.
  • The ability to navigate through the matches (little green arrows at the bottom let the user ‘back up’ or ’skip’ matches as desired).

Alternatives

It’s likely I’m simply unaware of many of the alternatives ‘out there’. Typically, for this type of thing, many turn to sed, a powerful command-line tool. However, sed has a substantial learning curve. In contrast, if one has already mastered perl regex, regexxer requires very little in the way of additional investment of energy. Other command-line tools which provide some of sed’s functionality, such as modifile, rpl, and replace, perhaps have their place but they certainly don’t offer the warm fuzzies of the GUI interface of regexxer.

Emacs, which typically seems to already have an extension for just about any task except cooking breakfast, didn’t seem to shine here. I can’t help but suspect that there’s an emacs tool available for this sort of thing but I haven’t happened across it yet.

Among other GUI tools, several offer similar functionality. For example, the text editor jedit can act in much the same way as regexxer. Unfortunately, jedit relies on java and, thus, things get dicey on planet Debian. Another, more focused tool, kfilereplace, is very straightforward but does not seem to be under active development and has much more limited functionality (e.g., the option to perform replacements ‘one-at-a-time’ is greyed out in the configuration window). Other utilities which seem to be designed to perform this type of task (e.g., modifile or regexsearch) don’t seem to be available for Debian.

Distros

Apparently those on planet Debian and planet Ubuntu have Ross Burton and Daniel Holbach to thank for the packaging of this excelent tool.

Posted in Debian, Ubuntu | Comments Off