This project is read-only.
regx is a grep-like command-line tool using the .NET regex syntax.
regs offers:
  • Use as a filter, on a file, on a filespec (recursive or not), on an url, or on a pattern of urls
  • Outputting matched lines, unmatched lines, matched text within lines, replacement strings, and nested balancing construct matches
  • Both .NET and ECMA syntax
  • Almost all .NET options for the Regex class (regx doesn’t support the multiline options)
  • Quick references on regex syntax and all options. Useful for when you just need to do one search and don’t want to open up MSDN to find the exact construct you need.

Basic use:


c:\... | regx <search pattern> [options]


c:\regx <search pattern> /f <filename> [options]
c:\regx <search pattern> /f <filespec> [/r] [options]



c:\regx <search pattern> /url <url> [options]
c:\regx <search pattern> /fusk /url <fusker pattern> [options]
c:\regx help
c:\regx help <option>


See the Documentation for details




/ReplacePattern <pattern>
/rp <pattern>

Line selection

/Output Matching
/Output All
/Output Unmatched
/v                 (same as "/output unmatched")

Output Format

/Details None
/Details Linenumber
/Details FileAndLine
/Format <format string>

Regex options

/CaseInsensitive           (or "/i")
/IgnorePatternWhitespace   (or "/ipw")
/RightToLeft               (or "/rtl")

Why another grep-thing?

There are a billion great grep tools out there, but we keep finding niches that need one more. In this case, regx provides
  • A CMD-friendly search and replace
  • The .NET syntax in all its glory (zero-width atomic negative look-ahead assertions, balancing constructs, optionally ignoring whitespace in regex patterns, etc.)
  • Filter support (stdin/stdout)
  • Replacements
  • File searching, file globbing
  • Searching pages via HTTP/HTTPS, including expanding fusker patterns
  • Quick reference on the .NET regex syntax at the command line

It does not do everything:

  • No replacing in files
  • No response file reading (yet?)
  • Match counting (well, you can kind of do counting with the /Format parameter)

In general, the real solution is to run PowerShell, but there are too many times where you need something quick and easy in a CMD or BAT file or to do some quick parsing and don’t have PowerShell open.

regx is just a quick tool for those needs.


I can’t recommend Rad Software’s (free) Regular Expression Designer enough. Great for learning .NET regex as well as for testing complex regex and replacements, and it includes a good reference to the syntax:


There are a lot of great regex tool that inspired regx, many of them right here at CodePlex. RSaR was the one that started this off:

Last edited Oct 14, 2012 at 9:48 PM by SethMorris, version 11