Regex Search and Rescue

a .NET alternative to the lame regex interpreter in VS7's "Find in Files" feature

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Download it! (version: 1.0.2003.5136)


Regex Search and Rescue is a standalone command-line "grep" tool, based on .NET, which has (arguably) the most advanced regular expression engine ever created.  In addition to being useful for ad hoc command line searches, it's designed to be easy to integrate into VS7 via the "External Tools" feature, so that results can be captured into VS's Output window.  (When run without args, it pops up a winform to solicit for input.)

The regex interpreter built into VS itself is lame -- a weird, alien beast that lacks many powerful features of the .NET regex engine -- yet it sports many helpful, nonstandard features such as "shortcut" mnemonics for things like C-language identifiers, numeric literals, and string literals.  Regex Search and Rescue (RSaR) attempts to provide the best of both worlds.


Simply copy RSaR.exe into your %Path% somewhere, and you're good to go.  Optionally, you may wish to configure it as an "external tool" in VS7.  Here are the suggested settings:

Title &Regex Search and Rescue
Command RSaR.exe
Initial directory $(SolutionDir)
Use Output window yes
Prompt for arguments no (RSaR will, however, prompt you for arguments)
Close on exit (n/a)


RSaR.exe [<filespec> <pattern> [/i] [/s] [/v] [/f] [/r=<replacementpattern>]]

<filespec> = files to search through (wildcards permitted).  by default RSaR recurses through subdirectories
<pattern> = regex pattern to search for (mind the backslash, doublequote, and caret rules of the command line)
<replacementpattern> = replacement pattern (all matches will be replaced with this string)

/i = RegexOptions.IgnoreCase
/s = RegexOptions.SingleLine
/v = mimic VS's helpful shorthand patterns for C identifiers (:i), numeric literals (:n), and string literals (:q)
/f = flat -- don't recurse subdirectories

If you specify no arguments at all, RSaR will popup a small winform UI to solicit arguments from you.  (This makes it handy to integrate into IDEs, where you can't always configure meaningful arguments before the tool is run.)


Regex Search and Rescue is free software -- you're free to modify it and redistribute it however you like.  Full source code is included.

In VS, you can cycle through the results in the Output window via the [F8] key.