The stupid question is the question not asked | |
PerlMonks |
Re: get next higher numberby AnomalousMonk (Archbishop) |
on Jun 11, 2018 at 19:34 UTC ( [id://1216430]=note: print w/replies, xml ) | Need Help?? |
Can I do it some how with regex? As hippo has alluded, a regex approach would seem far from ideal. Howsoever, the following seems to work, but requires Perl version 5.10+ for the (?(condition)yes-pattern|no-pattern) construct (which embeds the experimental (?{ CODE }) feature; see Extended Patterns in perlre): I leave further testing to you :)
(NB: From, I believe, Perl version 5.18 on, the Update: When discussing Perl version dependency in the first paragraph, I should also have mentioned that (*FAIL) was introduced with 5.10 (see Special Backtracking Control Verbs in perlre). However, the effect of (*FAIL) is exactly duplicated by (?!) in pre-5.10 regexen, so (?(condition)yes-pattern|no-pattern) remains the critical problem. Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|