Search and Replace with Multiple Regular Expressions

Up To Five Lists of Unlimited Search Terms or Regular Expressions

Most grep tools can only search for a single regular expression. With PowerGREP you can use up to five sets of search terms. Each set can use an unlimited number of regular expressions. Though this sounds complicated, it actually makes PowerGREP much easier to use. With PowerGREP you can use multiple simple regular expressions. A simple grep tool forces you to use one complex regex, if it can do the job at all.

A PowerGREP action can consist of up to five lists of search terms:

  • The main search, search-and-replace or data collection action.
  • Extra processing applied to the substitution text in a search-and-replace or data collection action.
  • File sectioning to limit the search to specific parts of each file, or to split files into records or sections.
  • Filter files to skip files that do or don't contain certain search terms.
  • Context needn't be line-based. Use regular expressions to see the most meaningful context for each search match.

In the first screen shot, PowerGREP is set to use a delimited list of regular expressions to perform two substitutions at once, replacing "referer" with "referrer", and "ez" (whole word only) with "easy". A separate list of four regular expressions is used to restrict the search to comments and strings in Java and C++ source code files. One for single-line comments, one for multi-line comments, one for strings, and one for characters. All this is very straightforward in PowerGREP, but impossible with any other grep tool.

Suppose you want to convert image file references from local Windows folders to UNIX server directories. Trying to do this with a basic grep tool that can use only a single regular expression would require a very complicated and incomprehensible regex. With PowerGREP it's much easier to use three simple regular expressions: one to limit the search to IMG tags, one to substitute SRC attributes in the IMG tags, and one to covert Windows back slashes to UNIX forward slashes in the SRC attribute paths. The second screen shot shows this.

No other Windows grep tool offers you such flexibility in combining multiple regular expressions.

Overlapping and Non-Overlapping Searches

It's up to you what happens when you search-and-replace "classification" with "category" and "cat" with "dog" on the string "The classification for cat is mammal." If you turn on non-overlapping search, "classification" is replaced with "category" and "cat" with "dog", resulting in "The category for dog is mammal."

If you turn off non-overlapping search, replacements will cascade. While undesirable in some situations, the cascade enables you to perform some very powerful data conversions. In our simple example, the first substitution would result in "The category for cat is mammal". If we're not restricting the search to whole words, the second will result in "The dogegory for dog is mammal."

Get Your Own Copy of PowerGREP Now

There are two ways in which you can get your own copy of PowerGREP and evaluate the software risk-free.

The best option is to buy your own copy of PowerGREP for US$ 159. Your purchase is covered by Jan Goyvaerts's personal three month risk-free unconditional money-back guarantee. This allows you to try the software without any limitations and without any risk for three months.

Alternatively, you can download the free evaluation version of PowerGREP. The free evaluation version can be downloaded anonymously. It allows you to explore PowerGREP for 15 days of actual use. Full documentation is included. The documentation extensively covers both PowerGREP itself, and the regular expression syntax.

Only US$ 159
Windows XP, Vista, 7, 8, 8.1, and 10
100% satisfied or money back
free trial download

Powerful searching and editing with multiple lists of regular expressions

Powerful searching and editing with multiple lists of regular expressions
Powerful searching and editing with multiple lists of regular expressions