开发者

using " in regular expression embedded in XML

Currently I'm trying to replace the character sequence \" with " using sed in an ant task. I successfully replaced the sequence \= with = but it just won't work for " because the parameter would end, no matter how much I escape the character. This is the code 开发者_开发技巧I'm using for \=:

<exec command="sed" input="${inputfile}" output="${outputfile}">
     <arg value="-e"/>
     <arg value="s|\\=|=|g"/>
</exec>

How can I get this working? What is the right escape for a quote? Any help is very much appreciated! thanks!


Try using &quot; which is the entity for double-quotes in XML.


It seems that you are writing XHTML. You don't escape " by writing \" in XHTML, but with &quot;. A full list of such "escapes" (they aren't escapes really, they are character entities) can be found here: http://www.w3schools.com/tags/ref_entities.asp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜