I’ve always found regular expressions a valuable tool for programmers. I mainly use it to look for routines or variables of which I suspect they may exist, but I don’t know the exact name. I’ve used a Win32 predecessor of Greppola for a long time, but since .NET regular expressions are very powerful, I decided to port it to .NET, and have enhanced it a bit further from there on, more or less as a test project.
I will not explain what regular expressions are, since there are numerous sources on that subject. I suggest a search in your favourite search engine, and I’m sure you’ll find plenty of material.
Greppola is a graphics user interface for the regular expressions capabilities of the .NET platform. It compiles with Delphi 2005, but you may be able to make it compile with Delphi 8 as well (after a few modifications, like replacing the loops with old fashioned indexed loops or loops explicitly using ).
Greppola’s main window contains the most important controls you need for a grep search. It looks like this:
In the top section you find three combo boxes to enter the search expression, the file masks and the directory. These are the search criteria.
Each combo box “remembers” the last 20 entries typed into its edit box. Beside each combo box you’ll find a small button, which allows you to edit the list of items contained in the combo box.
The Browse… button beside the Directory combo box lets you search a directory from a tree view of all folders.
If you have entered the search criteria, and possibly have set the options, you can start searching with the Search button. You can stop the search with the same button.
In the section below, you can set the following options:
- Case sensitive: if you want your search to regard the exact use of upper and lower case, check this option.
- Whole words only: if this option is checked, the search will only succeed if the text found is one whole word.
- Search subdirectories: if this option is checked, the search will also include subdirectories of the directory given in the combo box above.
- Text files only: this option allows you to exclude binary files, if you e.g. use a file mask like ..
- Search system folders: some system folders can cause problems when searched, so it may be useful to be able to exclude them.
The More… button opens a dialog with a few more options. More about that later.
In the bottom section, you find the results of a search. The lines of one file are grouped together, and you can open a file item to display the individual lines which contain a search result. The result of the search in each line is highlighted.
If you press the View button, the currently active line or file in the tree view will be opened in a simple editor. You can also double click a line to view it in the editor.
If you press the Open button, the currently selected file, or the file containing the selected line, will be opened with the program with which that file type is registered. So a .pas file will probably be opened with Delphi, and a .txt file with your text editor.
You can control if line numbers are displayed with the Show line numbers check box beside the tree view.