You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Anthony Bargnesi <ab...@gmail.com> on 2008/05/01 18:44:56 UTC
Using replaceregexp with a positive lookbehind regular expression
Hello,
Here is the replaceregexp call:
<replaceregexp file="\\${host}/${config.remote.path}/${config.remote.file}"
replace="disabled = true">
<regexp pattern="(?<=\#\[SYD\-DATASOURCE\]\s)disabled\s=\sfalse" />
</replaceregexp>
As you can see I wrote the regular expression: *
(?<=\#\[SYD\-DATASOURCE\]\s)disabled\s=\sfalse*
To match text like the following:
*......
(line break)
#[SYD-DATASOURCE]
disabled = false
......
......
*
When testing this regular expression out in a testing tool (Regex Creator) I
found that the positive lookbehind
matched *"disabled = false"* perfectly.
But ANT does not properly replace *"disabled = false" *with *"disabled =
true"*. Is the < throwing ANT
off or is there another reason why the positive lookbehind is failing?
Thanks in advance,
Tony