Outputs:my @extract; while (<DATA>) { push @extract,m/\d{8}/g; } print join "\n",@extract; __DATA__ 1,10000021 2,10000023 2,10000035 3,10000043 10000023 10000035 10000043 10000045 10000060 10000043,,zrous 10000045,,sjandw 10000060,,jnbro2 10000063,,eedwa 10000067,,empav 10000021/1 10000023/1 10000035/1 10000043/1 10000045/1 10000060/1 10000021/1,10000021 10000023/1,10000023 10000035/1,10000035 10000112,10002524,10000998,10000071,10000043,10000612,10000018,1000011 +0,10000011,10000013
Of course you could also write that as10000021 10000023 10000035 10000043 10000023 10000035 10000043 10000045 10000060 10000043 10000045 10000060 10000063 10000067 10000021 10000023 10000035 10000043 10000045 10000060 10000021 10000021 10000023 10000023 10000035 10000035 10000112 10002524 10000998 10000071 10000043 10000612 10000018 10000110 10000011 10000013
HTHmy @extracted=map { m/\d{8}/g } <DATA>;
Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)
In reply to Re: regular expression to extract 8 digit number from files
by demerphq
in thread regular expression to extract 8 digit number from files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |