in reply to Re: Extract a pattern from a string
in thread Extract a pattern from a string
I have changed the code and now i get the index i need$ perl -E 'my $s="ME170-5/2/8-ME172-2/2/6-ME4028"; while ($s=~m|(\d{1, +2})/(\d{1,2})/(\d{1,2})|g){++$x;say "$x Found $1-$2-$3:" . pos($s)}'
thank you$ perl -E 'my $s="ME170-5/2/8-ME172-2/2/6-ME4028"; while ($s=~m|(\d{1, +2}/\d{1,2}/\d{1,2})|g){++$x;say "$x Found $1:" . (index($s,$1)+1)}'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Extract a pattern from a string
by NetWallah (Canon) on Jun 10, 2012 at 14:46 UTC | |
by avim1968 (Acolyte) on Jun 11, 2012 at 05:35 UTC | |
by NetWallah (Canon) on Jun 11, 2012 at 13:54 UTC | |
by avim1968 (Acolyte) on Jun 14, 2012 at 05:15 UTC | |
|
Re^3: Extract a pattern from a string
by ambrus (Abbot) on Jun 10, 2012 at 22:14 UTC | |
by avim1968 (Acolyte) on Jun 11, 2012 at 04:03 UTC |