Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: regex needed

by MZSanford (Curate)
on Jan 30, 2003 at 18:17 UTC ( #231399=note: print w/ replies, xml ) Need Help??


in reply to regex needed

You have the matcing correct, but you did not save any of the data you matched. You may want to take a look at the perlre man page, in praticular what parenthesis are for. Something like the follwing (untested) code :

while (<DATA>) { if ($_ =~ /^(\d+\s+\[\d+\.\d+\.\d+\.\d+\]\s+[\d+\.\d+\.\d+\.\d+\]) +/) { print "Match=$1\n"; } }

The addition of getting the field is an excersize left to the reader.


from the frivolous to the serious


Comment on Re: regex needed
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2015-07-31 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls