| @@ -126,7 +126,10 @@ value, in the file <code>${src}/build.properties</code></p> | |||||
| <substitution id="id" expression="beta\1alpha"/><br> | <substitution id="id" expression="beta\1alpha"/><br> | ||||
| <substitution refid="id"/> | <substitution refid="id"/> | ||||
| </blockquote> | </blockquote> | ||||
| <h3>Examples</h3> | <h3>Examples</h3> | ||||
| <blockquote> | <blockquote> | ||||
| <pre> | <pre> | ||||
| <replaceregexp byline="true"> | <replaceregexp byline="true"> | ||||
| @@ -141,6 +144,7 @@ value, in the file <code>${src}/build.properties</code></p> | |||||
| with "NewProperty" in a properties file, preserving the existing | with "NewProperty" in a properties file, preserving the existing | ||||
| value, in all files ending in <code>.properties</code> in the current directory</p> | value, in all files ending in <code>.properties</code> in the current directory</p> | ||||
| <br> | |||||
| <blockquote> | <blockquote> | ||||
| <pre><replaceregexp match="\s+" replace=" " flags="g" byline="true"> | <pre><replaceregexp match="\s+" replace=" " flags="g" byline="true"> | ||||
| <fileset dir="${html.dir}" includes="**/*.html"/> | <fileset dir="${html.dir}" includes="**/*.html"/> | ||||
| @@ -148,7 +152,6 @@ value, in all files ending in <code>.properties</code> in the current directory< | |||||
| </pre></blockquote> | </pre></blockquote> | ||||
| <p>replaces all whitespaces (blanks, tabs, etc) by one blank remaining the | <p>replaces all whitespaces (blanks, tabs, etc) by one blank remaining the | ||||
| line separator. So with input | line separator. So with input | ||||
| <blockquote> | <blockquote> | ||||
| <pre> | <pre> | ||||
| <html> <body> | <html> <body> | ||||
| @@ -156,13 +159,47 @@ line separator. So with input | |||||
| <<TAB>> </body></html> | <<TAB>> </body></html> | ||||
| </pre></blockquote> | </pre></blockquote> | ||||
| would converted to | would converted to | ||||
| <blockquote> | |||||
| <pre> | <pre> | ||||
| <html> <body> | <html> <body> | ||||
| <h1> T E S T </h1> </body></html> | <h1> T E S T </h1> </body></html> | ||||
| </pre> | </pre> | ||||
| </blockquote> | |||||
| </p> | |||||
| <br><!-- small distance from code of the previous example --> | |||||
| <blockquote> | |||||
| <pre><replaceregexp match="\\n" replace="${line.separator}" flags="g" byline="true"> | |||||
| <fileset dir="${dir}"/> | |||||
| </replaceregexp> | |||||
| </pre></blockquote> | |||||
| <p>replaces all <tt>\n</tt> markers (beware the quoting of the backslash) by a line break. | |||||
| So with input | |||||
| <blockquote> | |||||
| <pre> | |||||
| one\ntwo\nthree | |||||
| </pre></blockquote> | |||||
| would converted to | |||||
| <blockquote> | |||||
| <pre> | |||||
| one | |||||
| two | |||||
| three | |||||
| </pre> | |||||
| </blockquote> | |||||
| Beware that inserting line breaks could break file syntax. For example in xml: | |||||
| <blockquote> | |||||
| <pre> | |||||
| <root> | |||||
| <text>line breaks \n should work in text</text> | |||||
| <attribute value="but breaks \n attributes" /> | |||||
| </root> | |||||
| </pre> | |||||
| </blockquote> | |||||
| </p> | </p> | ||||
| </body> | </body> | ||||
| </html> | </html> | ||||