Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: RegEx revision needed

by Wonko the sane (Deacon)
on Oct 09, 2003 at 13:48 UTC ( [id://297911]=note: print w/replies, xml ) Need Help??


in reply to RegEx revision needed

The entries you are missing in your output seem to be the numbers denoted by 'SW:'.
Neither of your regexes attempt to match for this at all. The 'SW;'
numbers also seem to have a unique trait that spaces are allowed as part
of the data. 'SW: 1.00.00 S'

The following is a modification of your loop that gives the output you specified.

while (<DATA>) { push @array, $1 if ( /Version:?\s*([^\s,]+)/i ); push @array, $1 if ( /SW:?\s*([^\n\r]+)/i ); }
Outputs:
:!./test.pl $VAR1 = '12.2(15)T8,'; $VAR2 = '2.2.0.1'; $VAR3 = '9.0.0.2'; $VAR4 = '6.3(7)'; $VAR5 = '5.0.0.3'; $VAR6 = '2.1.2.1'; $VAR7 = 'E5.8.0.3'; $VAR8 = '1.00.00 S'; $VAR9 = '12.0(14)';
Hope that helps.

Wonko

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://297911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found