Debian Codegraph @

docs/manual/tasks/propertyregex.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>Ant-contrib Tasks: PropertyRegex</title>
5 </head>
6
7 <body>
8 <h1>PropertyRegex</h1>
9
10 <p>Performs regular expression operations on an input string, and sets
11 the results to a property. There are two different operations that
12 can be performed:
13 <ol type="1">
14 <li>Replacement - The matched regular expression is replaced with
15 a substitition pattern</li>
16 <li>Selection - Groupings within the regular expression are selected
17 via a selection expression.
18 </ol>
19 </p>
20
21 <h2>Parameters</h2>
22 <table border="1" cellpadding="2" cellspacing="0">
23 <tr>
24 <th>Attribute</th>
25 <th>Description</th>
26 <th>Required</th>
27 </tr>
28 <tr>
29 <td valign="top">property</td>
30 <td valign="top">The name of the property to set.</td>
31 <td align="center" valign="top">Yes.</td>
32 </tr>
33 <tr>
34 <td valign="top">override</td>
35 <td valign="top">If the property is already set, should we change it's value.
36 Can be <code>true</code> or <code>false</code></td>
37 <td align="center" valign="top">No. Defaults to <code>false</code></td>
38 </tr>
39 <tr>
40 <td valign="top">input</td>
41 <td valign="top">The input string to be processed</td>
42 <td align="center" valign="top">Yes.</td>
43 </tr>
44 </tr>
45 <tr>
46 <td valign="top">regexp</td>
47 <td valign="top">The regular expression which is matched in
48 the input string.</td>
49 <td align="center" valign="top">Yes (can be specified in a
50 <code>&lt;regexp&gt;</code> subelement).
51 </td>
52 </tr>
53 <tr>
54 <td valign="top">select</td>
55 <td valign="top">A pattern which indicates what selection pattern you want
56 in the returned value. This uses the substitution pattern
57 syntax to indicate where to insert groupings created as a result
58 of the regular expression match.</td>
59 <td align="center" valign="top">Yes, unless a replace is specified</td>
60 </tr>
61 <tr>
62 <td valign="top">replace</td>
63 <td valign="top">A regular expression substitition pattern, which will be used
64 to replace the given regular expression in the input string.</td>
65 <td align="center" valign="top">Yes, unless a select is specified</td>
66 </tr>
67 <tr>
68 <td valign="top">casesensitive</td>
69 <td valign="top">Should the match be case sensitive</td>
70 <td align="center" valign="top">No. default is &quot;true&quot;.</td>
71 </tr>
72 <tr>
73 <td valign="top">global</td>
74 <td valign="top">Should a replacement operation be performed on the entire
75 string, rather than just the first occurance</td>
76 <td align="center" valign="top">No. default is <code>false</code>.</td>
77 </tr>
78 <tr>
79 <td valign="top">defaultValue</td>
80 <td valign="top">The value to set the output property to, if the
81 input string does not match the specific regular expression.</td>
82 <td align="center" valign="top">No.</td>
83 </table>
84
85 <h2>Select expressions</h2>
86
87 Expressions are selected in a the same syntax as a regular expression
88 substitution pattern.
89
90 <ul type="o">
91 <li><code>\0</code> indicates the entire property name (default).
92 <li><code>\1</code> indicates the first grouping
93 <li><code>\2</code> indicates the second grouping
94 <li>etc...
95 </ul>
96
97 <h2>Replacement</h2>
98 It is important to note that when doing a "replace" operation,
99 if the input string does not match the regular expression, then
100 the property is not set. You can change this behavior by supplying
101 the "defaultValue" attribute. This attribute should contain the value
102 to set the property to in this case.
103
104 <h2>Example</h2>
105
106 <pre>
107 <code>
108 &lt;propertyregex property="pack.name"
109 input="package.ABC.name"
110 regexp="package\.([^\.]*)\.name"
111 select="\1"
112 casesensitive="false" /&gt;
113 </code>
114 yields <code>ABC</code>
115 </pre>
116
117 <pre>
118 <code>
119 &lt;propertyregex property="pack.name"
120 input="package.ABC.name"
121 regexp="(package)\.[^\.]*\.(name)"
122 replace="\1.DEF.\2"
123 casesensitive="false" /&gt;
124 </code>
125 yields <code>package.DEF.name</code>
126 </pre>
127
128 <hr>
129 <p align="center">Copyright &copy; 2003 Ant-Contrib Project. All
130 rights Reserved.</p>
131
132 </body>
133 </html>