perl - How can I filter '?' out of XML? -



perl - How can I filter '?' out of XML? -

i have xml info this:

class="lang-xml prettyprint-override"><?xml version="1.0"?> <a> <b>someone ? messed up</b> <c>this question mark has disappear too?</c> </a>

now object validate if every opening tag has closing one, , filter out question marks in between <b> tags using perl.

i tried different variations of

$_[0] =~ s|>(.*)\?(.*)<|>$1$2<|g;

but cuts off <? , ?>. how can work without ruining xml version tag? also, using xml::simple overkill checking if tags closed properly?

regex not best solution fix xml.

to prepare regex question mark thing this kind of flawed regex. flawed because fixes single ?.

s/>([^<>]*?)[ ]?\?[ ]?([^<>]+?)</>$1 $2</g

# >([^<>]*?)[ ]?\?[ ]?([^<>]+?)< > ( [^<>]*? ) [ ]? \? [ ]? ( [^<>]+? ) <

xml perl

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -