Regex Search and Rescue (RSaR) is a command line search-and-replace tool (aka a "grep" tool) based on .NET, which offers one of the most advanced regular expression engines ever created.

RSaR.png

Regular expressions is a powerful but complex skill to learn -- so complex that I can only manage to keep one particular regex engine's syntax and idiosyncrasies in my head, at any one time. The .NET regex engine is compelling enough that I've forsaken the limited regex features in Visual Studio (and other) editors.

However, the search and replace feature in the Visual Studio editor sports a few very helpful, nonstandard matching features -- a set of "shortcut" mnemonics for patterns common to programmers -- things like C-language identifiers, numeric literals, and quoted strings. RSaR attempts to provide the best of both worlds, by (optionally) providing a few of those same built-in searches:
  • :i (keyword or identifier)
    • (\b[_a-zA-Z][_a-zA-Z0-9]*\b)
  • :n (numeric literal)
    • (\b[0-9]+(\.[0-9]+)?([Ee](\+|-)?[0-9]+)?\b)
  • :q (quoted string)
    • ((@""(""""|[^""])*"")|(""(\\.|[^""\\])*""))

In addition to being useful for ad hoc command line searches, RSaR is designed to be easy to integrate into the Visual Studio "External Tools" feature, so that results can be captured into VS's output window. (When run without arguments, a small GUI form is displayed, prompting for input.)

Many other IDEs have a similar capability to launch external tools and present their output -- it's almost the defining characteristic of an "IDE" -- so hopefully RSaR should integrate nicely into whatever IDE you currently fancy.

Just be awfully careful with that 'replace' feature, ok? Always backup, first -- on the command line, there is no undo!

Features:

  • color-enhanced console output
  • wildcard filename-matching and subdirectory recursion
  • ability to perform (parameterized) replacement on matches, in files
  • options can be specified on command line; defaults can be specified via app.config file
  • optional dialog-based UI, designed for use within IDEs and editors
  • emulation of several predefined regexes defined by the Visual Studio text editor

System Requirements:

.NET Framework v2.0

Last edited Dec 31, 2007 at 1:51 AM by ShawnVN, version 11