![]()
| Search and Replace with Multiple Regular ExpressionsRegular Expression Sequences
Most grep tools can only search for a single regular expression. With PowerGREP you can use as many regular expressions or literal search terms as you want, with PowerGREP's unique regular expression sequence capabilities. In the screen shot, I'm performing two substitutions at once, replacing "classification" with "category", and "cat" with "dog". I've also restricted the search to comments and strings in Java and C++ source code files, using three simple regular expressions. One for single-line comments, one for multi-line comments, and one for strings. All this is very straightforward in PowerGREP, but impossible with any other grep tool. Three SequencesA PowerGREP action can consist of up to three sequences:
No other Windows grep tool offers you such flexibility in combining multiple regular expressions. 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. Overlapping and Non-Overlapping SearchesIt's up to you what happens when executing the example in the screen shot 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 NowThere are two ways in which you can get your own copy of PowerGREP and evaluate the software risk-free.
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.
| |||
|