in reply to Regex to match ascending sequence
What did you expect $c++ to do, knowing that the first time the code is run the value of $c is the current regular expression ?
Anyway, here is something that should do what you want:
'234565432' =~ / (\d) (?{ $c = $1}) # Match the first number and initialize $c (?: (??{ ++$c }) # Same as the previous char + 1 )*/x; print $&;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to match ascending sequence
by ExReg (Priest) on Oct 15, 2015 at 17:19 UTC | |
|
Re^2: Regex to match ascending sequence
by Anonymous Monk on Oct 15, 2015 at 17:24 UTC | |
by LanX (Saint) on Oct 15, 2015 at 22:45 UTC | |
by ExReg (Priest) on Oct 16, 2015 at 14:41 UTC | |
by LanX (Saint) on Oct 16, 2015 at 18:19 UTC | |
by ExReg (Priest) on Oct 15, 2015 at 17:35 UTC |