Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^6: regex optional word match

by Rahul Gupta (Sexton)
on Jul 26, 2012 at 11:31 UTC ( #983829=note: print w/replies, xml ) Need Help??


in reply to Re^5: regex optional word match
in thread Parsind data in xlsx

Sorry Guys,I am new here.
I have one array with 2 Strings:

String1: "REMOTE [Mon Jul 16 21:49:33 2012] @@ [ueh1] [TNT] [2049 +0] [1916] 0.0- 1.0 sec 0.33 MBytes 2.74 Mbits/sec 6.056 ms 0/ + 233 (0%)". String2: "REMOTE [Mon Jul 16 21:49:34 2012] @@ [pdn1] [SSH] [2049 +9] [3] 1.0- 2.0 sec 0.34 MBytes 2.86 Mbits/sec".

In "String1" I have two extra values that is "6.056 ms" and "0/ 233 (0%)" and rest are same in both string.
I tried this regex:

<m/^REMOTE\s+\[(.*?)\]\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+\[(.*?)\]\s+ +(.*?)sec\s+(.*)MBytes\s+(.*)Mbits\/sec>
but need to add the above mentioned two values of String1 in regex and make them optional so that both condition gets passed and last values stored in $1, $2, $3 and so on.
Can anyone help me?
Thanks in advance

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983829]
help
Chatterbox?
marioroy At a large firm, had to awaken a security guy a few times so that nobody would catch him sleeping.
marioroy On a large dairy farm, almost went off the road with a 10 wheeler from exhaustion. On the farm, almost went off the silo with a big tractor. At the Fransiscan monastery, almost slipped off the dome while painting it.
[marioroy]: In Saudi Arabia caught fire but didn't burn. I think angels exist.
Lady_Aleena clean up after dinner finally.
[Discipulus]: uch! so we are twice lucky to have MCE..;=)
[marioroy]: Working a midnight graveyard shift, on the way home ran out of gas. just 2 minutes later somebody stops with a small tank of gas. It's wierd. There's always someone nearby for some reason.
[Lady_Aleena]: I was the one who stop[ed in the middle of a cold night to pick up a small family walking to a gas station. I got a few gallons of free gas for the round trip, and the grandmother said she'd pray for me.
[marioroy]: Folks do not know it, but MCE was ridiculously difficult. At Niagra Falls, heard a voice on enabling Grace while in the mist boat. That 10x performance is possible.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-05-29 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?