Powerful Text File Maintenance with Search and Replace using Regular Expressions

Simply Searching and Replacing through Large Numbers of Files

The basic way to use PowerGREP's search and replace functionality is like the search and replace feature offered by any text editor. Type in the text you want to have replaced in the search box. Put the text you want to have it replaced with in the Replace box. Specify the folder and file mask (such as *.txt), and click the Execute button. PowerGREP will then perform the search and replace operation on all files matching the file mask in the folder that you specified, and in its subfolders if you want.

But PowerGREP offers you much more than that. If you want, PowerGREP will present you with a list of all replacements that have been made. Double-click on a replacement to see its context. Prevent mistakes by previewing the results before modifying any files. Replace or revert individual matches in PowerGREP's full-featured file editor. Should you change your mind later, the Undo History will save your day by restoring all files that were modified.

Specify target options to tell PowerGREP to duplicate the files searched through and make the replacements in the duplicated files. This way you can easily produce different editions of the same set of files.

Powerful Text File Maintenance with Regular Expressions

While searching and replacing pieces of text is useful, you can automate many tedious editing tasks by adding regular expressions to the mix. Let me present you with an example. Suppose you have a rather long list of pairs in the form of one=another and you want to swap them. You can do this easily with PowerGREP by searching with the regular expression (\w+)=(\w+) and replacing with \2=\1. The regular expression will match a word, followed by an equals sign, followed by another word. The parenthesis capture the first word into the first "backreference", and the second word into the second "backreference". In the replacement text, we can reuse those with \1 and \2 respectively. So setting the replacement text to \2=\1 will swap the words.

Do not worry if the above looks complex. The documentation that is included with PowerGREP contains a detailed introduction to regular expressions. With a bit of practice, you can create simple regular expressions like the above in a matter of minutes. And when you spend time creating a complex regular expression, you can save it into a PowerGREP action file or library for instant reuse later.

Redact Files with Search and Delete

A search-and-delete is like a search-and-replace with a blank replacement. You can use it to easily redact a list of items. You can also use it to de-duplicate file content by deleting only duplicate matches.

Edit MS Word and OpenOffice Documents

PowerGREP's built-in converters for MS Word DOCX files and OpenOffice and LibreOffice ODT files allow you to search and replace through these files. In the File Selector, make sure "file formats to convert to plain text" is set to "writable proprietary formats" or "all writeable formats". Substituted text will retain its formatting, even though PowerGREP doesn't show you any formatting.


Search and replace automatically or interactively
"The first thing I tried [after upgrading to PowerGREP 5] was a find-and-replace within an MS Word document. It worked perfectly in a Hebrew right-to-left document! For me this is the most dramatic, long-awaited achievement, allowing, at last, a decent find-and-replace feature to replace [MS Word's] nonsensical "wild card" built-in feature. Many thanks, again, for a fantastic, must-have product!"
— Motti Teicher
  9 September 2016, Israel

Unlimited Power and Flexibility

While many Windows grep tools can search and replace with a single regular expression, PowerGREP offers unparalleled power and flexibility. Apply many changes at once by using a list of regular expressions. You can have the list processed sequentially, where each step works on the results of all previous steps, or concurrently, where each step is independent. There's no limit to the number of regular expressions you can use.

You can easily perform complex editing and conversion tasks with PowerGREP's unique file sectioning and extra processing features. Instead of creating one complex regular expression that does it all, use several simple regular expressions that work together. Use file sectioning to process only certain parts of each file, such as only headings, only body text, only markup tags, only comments and strings in source code, etc. Use extra processing to modify each search match in any way you want using full regular expressions, not just simply move text around with backreferences.

The Most Powerful GREP Tool for Windows

When to Use

Unique Abilities

All-in-One Tool

Widely Compatible

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.