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 "
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 "
. 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
精彩评论