Just as a warning, Regex is not particularly well-suited to xml/html input. The have a nested hierarchy format, while regex operates linearly. A tool specifically designed for xml, like
xmllint or
xmlstarlet is thus recommended for complex tasks.
However, if your task is simple and the code you're working on is dependably regular, then a regex solution isn't particularly out of order. Just be aware that it can get really messy if you're trying to target tags within tags within tags.
One simple tool that I really like is
hxpipe (part of the
html-xml-utils package). It converts xml-style input into a format that is more safely parseable by line-based tools. Using the above input, I came up with this:
Code:
hxpipe inputfile.txt | sed -rn ' /wx-value/,/[)]span/ { /^-/ s/-//p }'