Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: delete and substitute

by vitoco (Friar)
on Dec 09, 2009 at 12:50 UTC ( #811913=note: print w/ replies, xml ) Need Help??


in reply to delete and substitute

Your sample data doesn't seem to be valid XML, so XML modules will fail.

Try the following line as a replace for both of yours:

s/<(\w+)>\s*<\/\1>//g;

Beware that this won't remove two "adjacent" tags from different lines, because you are processing one line at a time.


Comment on Re: delete and substitute
Download Code
Replies are listed 'Best First'.
Re^2: delete and substitute
by Anonymous Monk on Dec 12, 2009 at 03:00 UTC
    This person keeps switching from HTML to XML, all trying to edit with regex, every time question changes by little bit

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://811913]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2015-07-31 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls