Substitution Mode

Redet also supports substitution as well as matching. Whether Redet is in match mode or substitution mode is controlled by a command on the Configure menu. In substitution mode a window is added in which to enter the substitution expression. In vertical layout this window appears below the regular expression window. In side-by-side layout it appears to the right of the regular expression window.

An example of substitution

Two types of output are available in substitution mode. In one, the output consists only of those input lines to which substitutions applied. This is exemplified by the example above. In the other, every input line is copied to the output, changed or unchanged as the case may be. This is exemplified by the following examples.

User-defined named character classes can be used in substitutions just as they can in matches.

An example of substitution

In this example, the facilities provided by some regular expression engines for referring to Unicode ranges make it easy to edit a Japanese-English lexicon so as to leave just the Japanese headword in kana and the gloss, cutting out the Chinese characters and the square brackets that surround the kana in the original.

An example of substitution

Here the substitution replaces the input text with just the third and sixth groups. The groups are as follows:

1.*matches any string
2\[matches left square bracket
3(\p{InHiragana}|\p{InKatakana})+matches at least one kana character
4\p{InHiragana}|\p{InKatakana}matches one kana character
5\]matches right square bracket
6.*matches any string


Back to Table of Contents