SPUG: Regex multi-line question

Richard Wood wildwood_players at yahoo.com
Tue Aug 3 11:57:31 CDT 2004


SPUGsters, 

I am always impressed at the demonstrations of regex's
that are shown at SPUG.  

I have been trying to figure out a one liner that will
parse out multiple sets of patterns from an xml file.

I can do it easily enough with a while<> loop (or a
parser) but I figure there is a more obfuscated
solution that one of you can propose using one line.

I am looking for a result something like:

Record, /home/woody/vinyl/Migration, JB_Migration.tar
CD, /home/woody/cd/Migration, JB_Migration.tar
TAPE, /home/woody/cass/Migration, JB_Migration.tar

>From the following file.

Don't ask/recommend that I use a parser, that isn't
the objective.  Think of it as more a perl golf
question.

<?xml version="1.0" encoding="UTF-8" ?>
<transfer>
<media type="Record">
  <server>MUSIC</server>
  <path>/home/woody/vinyl/Migration</path>
  <tarname>JB_Migration.tar</tarname>
</media>
<media type="CD">
  <server>MUSIC</server>
  <path>/home/woody/cd/Migration</path>
  <tarname>JB_Migration.tar</tarname>
</media>
<media type="TAPE">
  <server>MUSIC</server>
  <path>/home/woody/cass/Migration</path>
  <tarname>JB_Migration.tar</tarname>
</media>
</transfer>

Thanks, 

Rich Wood

=====
Richard O. Wood
Wildwood IT Consultants, Inc.
wildwood_players at yahoo.com
425.281.1914 mobile
206.544.9885 desk


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 


More information about the spug-list mailing list