in reply to Re^2: Regex to match ascending sequence
in thread Regex to match ascending sequence
This should do
my $regex = qr/ \d (??{ substr($&, -1) + 1 }) + /x; "148012" =~ $regex; print ">$&<" __END__ >012<
The minimal length of the sequence can be set by {x,} instead of the + quantifier. ¹
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
¹) with x = min-1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regex to match ascending sequence
by ExReg (Priest) on Oct 16, 2015 at 14:41 UTC | |
by LanX (Saint) on Oct 16, 2015 at 18:19 UTC |