ant ReplaceRegExp用双引号替换字符串

问题描述:

使用ANT我想用ANT replaceregexp任务找到/替换带空格和双引号的字符串。在XMLant ReplaceRegExp用双引号替换字符串

<ser:debug enabled="false"> 

以下两个

实际的标签不合格。

"<replaceregexp file="filepath" match="debug enabled="false"" replace="debug enabled="true"" byline="true" />" 

而且

"<replaceregexp file="filepath" match="debug\ enabled\=\"false\"" replace="debug\ enabled\=\"true\"" byline="true" />" 

我得到这个错误:

Element type "replaceregexp" must be followed by either attribute specifications, ">" or "/>"

然而,这一个正常工作而不考虑不同标签的任何问题......因为没有这样的特殊字符。

<replaceregexp file="filepath" match="sql-debug-mode>true" replace="sql-debug-mode>false" byline="true" /> 
+0

试过这种方式使用XML字符实体(不知道我在做正确的事)' byline =”true“/>'但出现此错误 实体”quotfalse“的引用必须以';'分隔符。 – enthuguy

+2

你错过了实体上的分号:'"' – sudocode

+0

非常感谢,也试过围绕'单引号...那工作 – enthuguy

也试图与'单引号...这周围的工作 - enthuguy