onegative has asked for the wisdom of the Perl Monks concerning the following question:
<ROOT hostname="bumblebee" tstamp="2011/09/21 22:24:05"> <APPLICATION> <PORT>7777</PORT> <APP_HOME>/extra/localcw/opt/APP/sun4</APP_HOME> <VERSION>V36.11.01</VERSION> <PERF_HOME>/usr/localcw/opt/APP/Solaris-2-9-sparc-64</PERF_HOM +E> <PERF_VERSION>glanceSunOS 5.9 (Solaris 9) (sparc, 64 Bit) 7.3. +00.6059 Jul 19 2006</PERF_VERSION> <STAR_VERSION>3.0</STAR_VERSION> <DEFAULT_ACCT>root</DEFAULT_ACCT> <HISTORY_RETENTION>90</HISTORY_RETENTION> <LAST_FILE_DOWN>StAR-201105090928.tar</LAST_FILE_DOWN> <LAST_STATUS>No download file found</LAST_STATUS> <ACL> <ACCOUNT id="f9a64ef61c"> <MD5>f9a64ef61c</MD5> <USERNAME>*</USERNAME> <HOST>flower</HOST> <PERMISSION>P</PERMISSION> </ACCOUNT> </ACL> </APPLICATION> </ROOT>
I would have thought the negate classes would have eliminated any and all values after the initial > but it doesn't. I have spent quite a while on different patterns but none work. Any and all suggestions will be greatly appreciated.foreach my $line (@xml) { chomp($line); if($line =~ /^\s*<(\w+)>[^\w*|\d*|<]/) { print "$1\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegEx Against Arbitrary XML Tags
by GrandFather (Saint) on Oct 19, 2011 at 21:50 UTC | |
|
Re: RegEx Against Arbitrary XML Tags
by anneli (Pilgrim) on Oct 19, 2011 at 23:09 UTC | |
by onegative (Scribe) on Oct 20, 2011 at 13:39 UTC | |
by Jenda (Abbot) on Oct 20, 2011 at 14:11 UTC | |
by Anonymous Monk on Oct 20, 2011 at 14:23 UTC | |
|
Re: RegEx Against Arbitrary XML Tags
by JavaFan (Canon) on Oct 20, 2011 at 11:22 UTC |