Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm using the following code to parse out Firmware Versions from an OID, and would like some input on my regex. It's only capturing 5 of the 9.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array = (); while (<DATA>) { push @array, $1 if m[Version\s+(.*)\,.*]i; push @array, $1 if m[Version\:\s+(.*)\s+PROM\.*]; } print Dumper (@array); # Array should be: # 12.2(15)T8 # 2.2.0.1 # 9.0.0.2 # 6.3(7) # 5.0.0.3 # 2.1.2.1 # E5.8.0.3 # 1.00.00 S # 12.0(14) __DATA__ Cisco Internetwork Operating System Software IOS (tm) 7200 Software (C7200-JS-M), Version 12.2(15)T8, RELEASE SOFT +WARE (fc2) TAC Support: http://www.cisco.com/tac Copyright (c) 1986-2003 by cisco Systems, Inc. Compiled Tue 09-Sep-03 18:47 by pwade Cabletron Systems, Inc. Firmware Version: 2.2.0.1 PROM Version: prom-1 +.1.0.5 RS 3000 - Riverstone Networks, Inc. Firmware Version: 9.0.0.2 PROM Ver +sion: prom-2.0.1.3 Cisco Systems WS-C5000 Cisco Catalyst Operating System Software, Version 6.3(7) Copyright (c) 1995-2002 by Cisco Systems X-Pedition Security Router XSR-1805 version 5.0.0.3 Cabletron ELS100-24TXG SW:2.1.2.1 2521 Testing - Foo Company Firmware Version: E5.8.0.3 PROM Version: pr +om-P1.3.2.1 Cabletron ELS100-24TX SW: 1.00.00 S Cisco Internetwork Operating System Software IOS (tm) 4000 Software (C4000-IS-M), Version 12.0(14), RELEASE SOFTWAR +E (fc1) Copyright (c) 1986-2000 by cisco Systems, Inc. Compiled Wed 01-Nov-00 00:06 by linda
Any thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegEx revision needed
by Abigail-II (Bishop) on Oct 09, 2003 at 12:30 UTC | |
by Anonymous Monk on Oct 09, 2003 at 12:55 UTC | |
|
Re: RegEx revision needed
by Wonko the sane (Curate) on Oct 09, 2003 at 13:48 UTC |