SPUG: re: XML regex
ced at carios2.ca.boeing.com
ced at carios2.ca.boeing.com
Thu Aug 5 19:04:41 CDT 2004
Hello all,
My recent suggested XML regex needed a workaround
which I failed to mention. The '\G' below really
shouldn't be necessary. The bug was fixed by 5.8.4
but 5.6.1 and 5.8.1 still required the '\G'.
Rgds,
--
Charles DeRykus
use warnings;
use strict;
# FORE...!! : golf course use only...
{ local $/; $_ = <DATA>; }
while ( m{ \G .*? <media\stype="(.*?)"
.*? <path> (.*?) </path>
.*? <tarname> (.*?) </tarname> }xsg ) {
my( $type,$path,$tar ) = ( $1, $2, $3);
print join( ", " => $type,$path,$tar), "\n";
}
__END__
<?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>
More information about the spug-list
mailing list