| @@ -126,7 +126,10 @@ value, in the file <code>${src}/build.properties</code></p> | |||
| <substitution id="id" expression="beta\1alpha"/><br> | |||
| <substitution refid="id"/> | |||
| </blockquote> | |||
| <h3>Examples</h3> | |||
| <blockquote> | |||
| <pre> | |||
| <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 | |||
| value, in all files ending in <code>.properties</code> in the current directory</p> | |||
| <br> | |||
| <blockquote> | |||
| <pre><replaceregexp match="\s+" replace=" " flags="g" byline="true"> | |||
| <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> | |||
| <p>replaces all whitespaces (blanks, tabs, etc) by one blank remaining the | |||
| line separator. So with input | |||
| <blockquote> | |||
| <pre> | |||
| <html> <body> | |||
| @@ -156,13 +159,47 @@ line separator. So with input | |||
| <<TAB>> </body></html> | |||
| </pre></blockquote> | |||
| would converted to | |||
| <blockquote> | |||
| <pre> | |||
| <html> <body> | |||
| <h1> T E S T </h1> </body></html> | |||
| </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> | |||
| </body> | |||
| </html> | |||