This file is indexed.

/usr/share/doc/pyxplot/html/sect0032.html is in pyxplot-doc 0.8.4-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Regular Expressions</title>

<link href="sect0033.html" title="String Manipulation Functions" rel="next" />
<link href="sec-stringsubop.html" title="The String Substitution Operator" rel="prev" />
<link href="sec-stringvars.html" title="String Variables" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-stringsubop.html" title="The String Substitution Operator"><img alt="Previous: The String Substitution Operator" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sec-stringvars.html" title="String Variables"><img alt="Up: String Variables" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0033.html" title="String Manipulation Functions"><img alt="Next: String Manipulation Functions" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0031.html">Programming and Flow Control</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sec-stringvars.html">String Variables</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Regular Expressions</b>
</span>
</span>
<hr />
</div>

<div><h2 id="a0000000033">6.1.2 Regular Expressions</h2>
<p>String variables can be modified using the search-and-replace string operator<a name="a0000000570" id="a0000000570"></a><a href="#a0000000571" class="footnote"><sup class="footnotemark">1</sup></a>, =<img src="images/img-0028.png" alt="$\sim $" style="vertical-align:2px; 
                                     width:12px; 
                                     height:5px" class="math gen" /><a name="a0000000572" id="a0000000572"></a>, which takes a regular expression with a syntax similar to that expected by the shell command <tt class="tt">sed</tt><a name="a0000000573" id="a0000000573"></a> and applies it to the relevant string variable.<a href="#a0000000574" class="footnote"><sup class="footnotemark">2</sup></a><a name="a0000000575" id="a0000000575"></a> In the following example, the first instance of the letter <tt class="tt">s</tt> in the string variable <tt class="tt">twister</tt> is replaced with the letters <tt class="tt">th</tt>: </p><p> <tt class="tt">pyxplot&gt; <b class="bf">twister="seven silver soda syphons"</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">twister =<img src="images/img-0028.png" alt="$\sim $" style="vertical-align:2px; 
                                     width:12px; 
                                     height:5px" class="math gen" /> s/s/th/</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print twister</b></tt><br /><tt class="tt">theven silver soda syphons</tt>  </p><p>Note that only the <tt class="tt">s</tt> (substitute) command of <tt class="tt">sed</tt> is implemented in PyXPlot. Any character can be used in place of the <tt class="tt">/</tt> characters in the above example, for example: </p><pre>
twister =~ s's'th'
</pre><p>Flags can be passed, as in <tt class="tt">sed</tt> or <tt class="tt">perl</tt>, to modify the precise behaviour of the regular expression. In the following example the <tt class="tt">g</tt> flag is used to perform a global search-and-replace of all instances of the letter <tt class="tt">s</tt> with the letters <tt class="tt">th</tt>: </p><p> <tt class="tt">pyxplot&gt; <b class="bf">twister="seven silver soda syphons"</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">twister =<img src="images/img-0028.png" alt="$\sim $" style="vertical-align:2px; 
                                     width:12px; 
                                     height:5px" class="math gen" /> s/s/th/g</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print twister</b></tt><br /><tt class="tt">theven thilver thoda thyphonth</tt>  </p><p>TableĀ <a href="sect0032.html#tab:re_flags">6.2</a> lists all of the regular expression flags recognised by the =<img src="images/img-0028.png" alt="$\sim $" style="vertical-align:2px; 
                                     width:12px; 
                                     height:5px" class="math gen" /> operator. </p><div id="tab:re_flags" class="table"><p><small class="footnotesize"><table cellspacing="0" class="tabular">
<tr>

    
    <td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-left:1px solid black"><p> <tt class="tt">g</tt> </p></td>

    
    <td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> Replace <i class="it">all</i> matches of the pattern; by default, only the first match is replaced. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-left:1px solid black"><p><tt class="tt">i</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> Perform case-insensitive matching, such that expressions like <tt class="tt">[A-Z]</tt> will match lowercase letters, too. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-left:1px solid black"><p><tt class="tt">l</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> Make <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />w</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />W</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />b</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />B</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />s</tt> and <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />S</tt> dependent on the current locale. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-left:1px solid black"><p><tt class="tt">m</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> When specified, the pattern character <tt class="tt"><img src="images/img-0024.png" alt="\^{}" style="vertical-align:9px; width:5px; height:4px" class="accent gen" /></tt> matches the beginning of the string and the beginning of each line immediately following each newline. The pattern character <tt class="tt">$</tt> matches at the end of the string and the end of each line immediately preceding each newline. By default, <tt class="tt"><img src="images/img-0024.png" alt="\^{}" style="vertical-align:9px; width:5px; height:4px" class="accent gen" /></tt> matches only the beginning of the string, and <tt class="tt">$</tt> only the end of the string and immediately before the newline, if present, at the end of the string. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-left:1px solid black"><p><tt class="tt">s</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> Make the <tt class="tt">.</tt> special character match any character at all, including a newline; without this flag, <tt class="tt">.</tt> will match anything except a newline. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-left:1px solid black"><p><tt class="tt">u</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> Make <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />w</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />W</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />b</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />B</tt>, <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />s</tt> and <tt class="tt"><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />S</tt> dependent on the Unicode character properties database. </p></td>

</tr><tr>

    
    <td style="border-bottom-color:black; border-bottom-width:1px; text-align:left; border-bottom-style:solid; border-left:1px solid black"><p><tt class="tt">x</tt> </p></td>

    
    <td style="border-bottom-color:black; border-bottom-width:1px; text-align:left; border-bottom-style:solid; border-right:1px solid black"><p> This flag allows the user to write regular expressions that look nicer. Whitespace within the pattern is ignored, except when in a character class or preceded by an un-escaped backslash. When a line contains a <tt class="tt">#</tt>, neither in a character class nor preceded by an un-escaped backslash, all characters from the left-most such <tt class="tt">#</tt> through to the end of the line are ignored. </p></td>

</tr>
</table></small> </p><div class="caption"><b>Table 6.2</b>: <span>A list of the flags accepted by the =<img src="images/img-0028.png" alt="$\sim $" style="vertical-align:2px; 
                                     width:12px; 
                                     height:5px" class="math gen" /> operator. Most are rarely used, but the <tt class="tt">g</tt> flag is very useful.</span></div></div></div>



<div id="footnotes">
<p><b>Footnotes</b></p>
<ol>
<li id="a0000000571">Programmers with experience of <tt class="tt">perl</tt> will recognise this syntax.</li><li id="a0000000574">Regular expression syntax is a massive subject, and is beyond the scope of this manual. The official GNU documentation for the <tt class="tt">sed</tt> command is heavy reading, but there are many more accessible tutorials on the web.</li>
</ol>
</div>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-stringsubop.html" title="The String Substitution Operator"><img alt="Previous: The String Substitution Operator" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sec-stringvars.html" title="String Variables"><img alt="Up: String Variables" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0033.html" title="String Manipulation Functions"><img alt="Next: String Manipulation Functions" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>