in reply to regular expression to match in between digits..
use strict; use warnings; my @matches; while (<DATA>) { # MAN followed by at least one number while (m/MAN((\D\d+)+)/ig) { # Trim leading non-digit, split rest of number string into ind +ividual numbers my $n = $1; $n =~ s/^\D//; push @matches, split /\D/, $n; } } print join ',', @matches; __DATA__ MAN:113 some other test 666.... MAN 231,456 TEXT text alpha Man 999 etc.. 77789 etc man 111,222,333
Output: 113,231,456,999,111,222,333
|
|---|