Im using this code:Mod Sub-Module Model Serial ---- --------------------------- ------------------ ----------- 1 Distributed Forwarding Card WS-F6700-DFC3CXL SAL1434RLPY 3 7600 ES+ DFC XL 7600-ES+3CXL JAE14520N29 3 7600 ES+T 20x1GE SFP 76-ES+T-20GQ JAE145301XM 5 Policy Feature Card 3 7600-PFC3CXL JAE14330E6J 5 C7600 MSFC4 Daughterboard 7600-MSFC4 JAE14320QBE 6 Policy Feature Card 3 7600-PFC3CXL JAE14330EAO 6 C7600 MSFC4 Daughterboard 7600-MSFC4 JAE14320QA8 7 Distributed Forwarding Card WS-F6700-DFC3CXL SAL1433QHBR 8 Distributed Forwarding Card WS-F6700-DFC3CXL SAL1433QXF9
But this regex dont get the 2nd and 3rd line ... (7600 ES+ DFC XL / 7600 ES+T 20x1GE SFP) How i can get all line whit special chars? Im thinking my problem is because "+" in these lines ...open(FILE,"show_module.dat"); while(<FILE>){ if ($_ =~ /^\s*(\d+)\s+(.*?) (\s*)([WS|76])(.*?)\s+(\w+)\s+(.*)\s+( +.*)/) { print "SLOT = $1\n"; print "Desc = $2\n"; print "Model = $3\n"; } } close(FILE);
In reply to How we can do regex of this? by xMiDgArDx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |