Results

The results of executing the regular expression are displayed in the result window. Commands on the File menu allow this window to be unlocked for editing and relocked. The Save command allows its contents to be saved to a file.

There is some subtlety to what the result of execution is. In match mode, Redet reports all of the lines that matched, where most programs consider a line to match a regular expression if any substring matches. For example, abcd will be considered a match to bc. A few programs consider a line to match a regular expression only if the match is exhaustive. These programs will not consider abcd a match to bc: only abcd would be considered a match. Which behavior the program exhibits is indicated by annotation of the program name on the Execute button. See Information for details. Some programs provide the option of emitting only the portion of the line that matched. In this case, you may choose which option you prefer from the program's control panel or by using the corresponding init file setting.

In substitution mode, the result reported is the output of the substitution operation. Redet allows you to choose between seeing the entire output or only those lines in which something was actually changed. This is controlled from the Miscellaneous submenu of the Configure menu or by the init file command OutputOnlyChangedLinesP.

If you want to know just the part that matched when a program that reports matches anywhere in the line, there is a way to do it if the program is one that does substitution as well as matching. Make the part you are interested in a capture group and use substitution mode to make the capture group your result, e.g.

regular expression<title>(.+)</title>
substitution expression\t
The regular expression will match a string beginning with <title> and ending with </title> and put the intervening material into the first (and only) capture group. The substitution expression will then make this into the output.



Unicode Browser

(Note that this figure is slightly misleading in that for Tcl Redet does provide the option of emitting only the matching portion of the line.)

Next

Back to Table of Contents