sdc7 发表于 2012-7-19 08:36:29

求个正则··【已解决】

本帖最后由 sdc7 于 2012-7-19 09:18 编辑

代码如下 想分组提取出IP网关 即network还有interface
re=.id=*1=address=192.168.0.240/24=network=192.168.0.0=broadcast=192.168.0.255=interface=ether1=actual-interface=ether1=invalid=false=dynamic=false=disabled=false =comment=LAN !re=.id=*2=address=115.62.165.32/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out15=actual-interface=pppoe-out15=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*3=address=115.54.91.131/32=network=115.54.95.254=broadcast=0.0.0.0=interface=pppoe-out3=actual-interface=pppoe-out3=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*4=address=115.62.165.34/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out16=actual-interface=pppoe-out16=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*5=address=115.62.165.37/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out14=actual-interface=pppoe-out14=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*7=address=115.62.165.44/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out8=actual-interface=pppoe-out8=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*8=address=115.62.165.46/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out1=actual-interface=pppoe-out1=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*A=address=182.124.128.107/32=network=182.124.143.254=broadcast=0.0.0.0=interface=pppoe-out6=actual-interface=pppoe-out6=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*B=address=182.124.142.54/32=network=182.124.143.254=broadcast=0.0.0.0=interface=pppoe-out2=actual-interface=pppoe-out2=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*C=address=115.62.165.50/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out10=actual-interface=pppoe-out10=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*D=address=115.62.165.55/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out19=actual-interface=pppoe-out19=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*E=address=115.62.165.56/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out12=actual-interface=pppoe-out12=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*F=address=115.54.81.11/32=network=115.54.95.254=broadcast=0.0.0.0=interface=pppoe-out18=actual-interface=pppoe-out18=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*10=address=115.62.165.59/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out17=actual-interface=pppoe-out17=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*11=address=115.62.165.61/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out11=actual-interface=pppoe-out11=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*12=address=115.62.165.62/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out7=actual-interface=pppoe-out7=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*13=address=115.62.165.63/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out13=actual-interface=pppoe-out13=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*14=address=115.62.165.65/32=network=115.62.175.254=broadcast=0.0.0.0=interface=pppoe-out9=actual-interface=pppoe-out9=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*17=address=123.4.161.69/32=network=123.4.160.1=broadcast=0.0.0.0=interface=pppoe-out20=actual-interface=pppoe-out20=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*18=address=123.4.161.127/32=network=123.4.160.1=broadcast=0.0.0.0=interface=pppoe-out4=actual-interface=pppoe-out4=invalid=false
=dynamic=true=disabled=false        =comment= !re=.id=*19=address=123.4.160.212/32=network=123.4.160.1=broadcast=0.0.0.0=interface=pppoe-out5=actual-interface=pppoe-out5=invalid=false
=dynamic=true=disabled=false        =comment= !done

sdc7 发表于 2012-7-19 09:17:58

测试通过 感谢·QQ群·Snow.Leaf提供
address=(\d*\.\d*\.\d*\.\d*)[^\n]*?network=(\d*\.\d*\.\d*\.\d*)[^\n]*?interface=([\w-]*)
页: [1]
查看完整版本: 求个正则··【已解决】