Hi, Thanks a lot for the advice.
But , we cannot change the code, since we have one common code which parses the reg-exp and extracts the groups. So we want to write the reg-exp with nested groups.Each group extracted is the "Local interface " group. The attributes we want to collect from this group will be the subgroups. Is this possible using reg-exp ? We did the following : (Local interface: [\w\W\s]+VC ID: (\d+),[\w\W\s]+packet totals: receive (\d+), send (\d+)\s+byte totals:\s+receive (\d+), send (\d+)\s+packet drops:\s+ receive (\d+), send (\d+))+ With this, am able to extract only the last group. Any hints, ideas on how to proceed on this would be of great help. Thanks Again, Sarika > -----Original Message----- > From: Michael McCallum [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 16, 2003 5:15 AM > To: Regexp Users List > Subject: Re: Regexp with groups and subgroups > > > Divide and conquer just break up your input into separate interfaces. > > something like > > String output = getShowOutput(); > int index = output.indexOf( "interface:" ); > int secondIndex = output.indexOf( "interface:", index ); > String firstInterface = output.substring( index, secondIndex ); > > then do the match on firstInterface and get the values and > repeat the process > to get the next interface. > > kind regards > > Michael > On Tuesday, 16 September, 2003 00:21, Sarika Inamdar wrote: > > Hi All, > > > > We have to write a regular expression to extract some values for > > mutiple interfaces. > > > > For example : We have a command : > > > > "show mpls l2 vc details " > > > > The output of this command gives details of the mpls for mutiple > > interfaces viz : > > > > Local interface: VFI erms1 up > > Destination address: 10.8.99.3, VC ID: 13, VC status: up > > Tunnel label: 29, next hop point2point > > Output interface: PO9/2, imposed label stack {29 40} > > Create time: 1w2d, last status change time: 2d09h > > Signaling protocol: LDP, peer 10.8.99.3:0 up > > MPLS VC labels: local 40, remote 40 > > Group ID: local 0, remote 0 > > MTU: local 9216, remote 9216 > > Remote interface description: > > Sequencing: receive disabled, send disabled > > VC statistics: > > packet totals: receive 143929, send 488 > > byte totals: receive 10266253, send 42323 > > packet drops: receive 0, send 0 > > > > Local interface: VFI ERMS-VPN-2000 up > > Destination address: 10.8.99.3, VC ID: 2000, VC status: up > > Tunnel label: 29, next hop point2point > > Output interface: PO9/2, imposed label stack {29 42} > > Create time: 2d03h, last status change time: 2d03h > > Signaling protocol: LDP, peer 10.8.99.3:0 up > > MPLS VC labels: local 62, remote 42 > > Group ID: local 0, remote 0 > > MTU: local 1500, remote 1500 > > Remote interface description: > > Sequencing: receive disabled, send disabled > > VC statistics: > > packet totals: receive 305, send 306 > > byte totals: receive 25925, send 27234 > > packet drops: receive 0, send 0 > > > > We need to extract the highlighted values like VCD id and the VC > > statistics like ( packet totals, byte totals, packet drops) > > > > We have written a reg exp which will extract the above > value. But this > > works only for one interface. The reg-exp is : > > VC ID: (\d+),[\w\W\s]+packet totals: receive (\d+), send > (\d+)\s+byte > > totals:\s+receive (\d+), send (\d+)\s+packet drops:\s+ > receive (\d+), > > send (\d+) > > Can this be enhanced into groups and subgroups to get > values for all the > > interfaces listed in the above output ? > > Any help on this is greatly appreciated. > > Thanks in Advance, > > Sarika > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > -- > Michael McCallum > Software Engineer > SnapHire Inc. > http://www.SnapHire.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]