D
Darpan
Hi,
I am trying to write a task to replace all occurrences of single and
double quotes on a line starting with a "*" to a "\"" or "\'".
Basically i want to escape the double\single quotes. My code works for
only the first occurrence of a single or double quote and cant get it
to work for multiple occurrences of the quotes. This is what I have
done so far
<project name="Replace Example" default="doublequotes" basedir=".">
<target name="doublequotes" description="Replaces occurence of">
<replaceregexp file= "test.txt" byline="true">
<regexp pattern="(\*.*)(\p{Punct})"/>
<substitution expression="\1\\$2" />
</replaceregexp >
</target>
</project>
My test.txt contains the following lines
* Hello the"re
* Hello t'here
"Hello there"
* "Hello there"
I am executing ant using the following command
ant -f double_quotes.xml
-Dant.regexp.regexpimpl=org.apache.tools.ant.util.regexp.JakartaOroRegexp
Any help will be highly appreciated. Thanks in advance.
Darpan
I am trying to write a task to replace all occurrences of single and
double quotes on a line starting with a "*" to a "\"" or "\'".
Basically i want to escape the double\single quotes. My code works for
only the first occurrence of a single or double quote and cant get it
to work for multiple occurrences of the quotes. This is what I have
done so far
<project name="Replace Example" default="doublequotes" basedir=".">
<target name="doublequotes" description="Replaces occurence of">
<replaceregexp file= "test.txt" byline="true">
<regexp pattern="(\*.*)(\p{Punct})"/>
<substitution expression="\1\\$2" />
</replaceregexp >
</target>
</project>
My test.txt contains the following lines
* Hello the"re
* Hello t'here
"Hello there"
* "Hello there"
I am executing ant using the following command
ant -f double_quotes.xml
-Dant.regexp.regexpimpl=org.apache.tools.ant.util.regexp.JakartaOroRegexp
Any help will be highly appreciated. Thanks in advance.
Darpan