in reply to Check a string for consecutive digits
You could use match-time pattern interpolation.
$ perl -Mstrict -Mwarnings -E ' say m{(?x) ( \d ) (??{ ( $1 + 1 ) . ( $1 + 2 ) . ( $1 + 3 ) }) } ? qq{$_ - Match} : qq{$_ - No match} for qw{ abc ab12c 2345 234y 01234 };' abc - No match ab12c - No match 2345 - Match 234y - No match 01234 - Match $
I hope this is helpful.
Cheers,
JohnGG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Check a string for consecutive digits
by Anonymous Monk on Nov 25, 2015 at 23:58 UTC | |
by johngg (Canon) on Nov 28, 2015 at 13:26 UTC |