开发者

using " in regular expression embedded in XML

开发者 https://www.devze.com 2023-03-03 06:56 出处:网络
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 woul

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

精彩评论

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