in reply to Re: space before and after
in thread space before and after

Remove the spaces in front of tags and after the tags.

Replies are listed 'Best First'.
Re^3: space before and after
by ikegami (Patriarch) on Sep 03, 2009 at 05:30 UTC

    So the output is wrong, then.

    s/\s+(?=<)//g; s/(?<=>)\s+//g;
    • Assumes no unescaped "<" and ">" in flow or other content.
    • Assumes no "<" and ">" in attribute values, comments or in CDATA sections.
    • Assumes no NET tags (a poorly supported SGML construct).
    • Disregards the fact that this changes the HTML to something that's not equivalent.
      Please tell me how to remove the space in "<br/>" ahead and behind the text
      __DATA__ Hi &lt;br/&gt; r u
        This is getting very repetitive, maybe you can adopt any of the previous examples
        s~\Q <br> \E~<br>~ib;