File: substitution.html

package info (click to toggle)
redet 8.26-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,696 kB
  • sloc: tcl: 38,887; makefile: 58
file content (79 lines) | stat: -rw-r--r-- 2,925 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<!--Time-stamp: <2005-12-19 11:49:19 poser> -->
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
   <META NAME="Author" CONTENT="Bill Poser">

   <TITLE>Redet Reference Manual: Substitution Mode</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFE2C0" VLINK="#0000EE" LINK="#AA0066" ALINK="#FF0000">

<h2><a name="substitution">Substitution Mode</a></h2>
<P>
Redet also supports substitution as well as matching. Whether Redet is in match mode
or substitution mode is controlled by a command on the <i>Configure</i> 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.
</P>

<br>
<div align="center">
<img src="Images/SubMode01.jpg" width="90%" alt="An example of substitution" border="2">
</div>
<br clear="all">

<P>
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.
</P>

<P>
User-defined named character classes can be used in substitutions just as they
can in matches.
</P>
<br>
<div align="center">
<img src="Images/SubMode02.jpg" width="90%" alt="An example of substitution" border="2">
</div>
<br clear="all">

<P>
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 <i>kana</i> and the gloss, cutting out
the Chinese characters and the square brackets that surround the <i>kana</i> in the
original.
</p>
<br>
<div align="center">
<img src="Images/SubMode03.jpg" width="90%" alt="An example of substitution" border="2">
</div>
<br clear="all">
<P>
Here the substitution replaces the input text with just the third and sixth groups.
The groups are as follows:
<center>
<TABLE border="2" cellpadding="8" cellspacing="2">
<tr><td>1</td><td>.*</td><td>matches any string</td></tr>
<tr><td>2</td><td>\[</td><td>matches left square bracket</td></tr>
<tr><td>3</td><td>(\p{InHiragana}|\p{InKatakana})+</td><td>matches at least one <i>kana</i> character</td></tr>
<tr><td>4</td><td>\p{InHiragana}|\p{InKatakana}</td><td>matches one <i>kana</i> character</td></tr>
<tr><td>5</td><td>\]</td><td>matches right square bracket</td></tr>
<tr><td>6</td><td>.*</td><td>matches any string</td></tr>
</table>
</center>
</p>
<br>
<center><a href="misctools.html">Next</a></center>
<br>
<center><a href="Manual.html">Back to Table of Contents</a></center>
</body>
</html>