Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: RegEx revision needed

by Wonko the sane (Deacon)
on Oct 09, 2003 at 13:48 UTC ( #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


Comment on Re: RegEx revision needed
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2014-12-18 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls