I have several hundred lines of firmware I'm parsing out and have gotten them all with the exception of three.

#!/usr/bin/perl use strict; use warnings; my @array = (); while (<DATA>) { push @array, $1 if ( /Version:?\s*([^\s,]+)/i ); push @array, $1 if ( /SW:?\s*$|SW_REV:?\s*([^.]+)/ ); push @array, $1 if ( /Rev\s*$|\s+Revision:?\s*([^\s,]+)/i ); } foreach (@array) { $_ =~ s/Copyright//i; print "FW: $_\n"; } # OUTPUT IS: #FW: rdtg7.0.4.7 #FW: 0; #FW: CG4D_05 #OUTPUT SHOULD BE #FW: rdtg7.0.47 #FW: 4.1.4p #FW: CG4D_05.3.02 __DATA__ Company: Nuera Communications, Inc., ProductFamily: ORCA Series, Produ +ct: RDT-8, Version: rdtg7.0.4.7, HardwareRevision: A Motorola Corporation SB4100E Cable Modem: Hardware version: 0; OS: VxW +orks 5.3.1; Software version: 4.1.4p <<HW_REV: 0; VENDOR: Motorola; BOOTR: CG4D_05.3.02; SW_REV: CG4D_05.3. +02; MODEL: SBV4200>>OS: VxWorks 5.4
Any suggestions are appreciated!

In reply to RegEx advice needed by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.