Ah, but in order to clean it, you must do some kind of parsing. (That's what the process of reading a text stream in order to perform operations that will output a transformed text stream is.) My point is that regular expressions alone are prone to failure.
But if you're looking to do a RE only solution, and you're ONLY looking to remove EMPTY tags then something involving a match on >< with a look-behind for < and look-ahead for > might do...
Good luck in any event!
Update: I'm not claiming to have a dictionary definition of parsing, I was just trying to explain how I see the situation: reading the file, separating tag from text, and throwing away the empty tags... in short, parsing :)
Update: no problem vek, I didn't think it was a dodgy post in the least, and I wasn't trying to beat you down at all - in fact it sounds like you have way more experience with XML parsing than I do! Code on brother....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.