Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks !
Searching for a number, followed by a char, followed by the same number is easy:
m/(\d).\1/
But how to search for a number, followed by a char, followed by the same number increased by one (\1+1) ?
So valid would be:
3x4, 5a6
Many thanks for your help !!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: arithmetic in a regex ?
by choroba (Cardinal) on Nov 13, 2023 at 10:26 UTC | |
by Anonymous Monk on Nov 13, 2023 at 11:00 UTC | |
Re: arithmetic in a regex ?
by GrandFather (Saint) on Nov 13, 2023 at 08:53 UTC | |
by Anonymous Monk on Nov 13, 2023 at 10:01 UTC | |
Re: arithmetic in a regex ?
by afoken (Chancellor) on Nov 13, 2023 at 09:18 UTC | |
Re: arithmetic in a regex ?
by Tux (Canon) on Nov 13, 2023 at 08:26 UTC | |
by Anonymous Monk on Nov 13, 2023 at 08:34 UTC | |
by Corion (Patriarch) on Nov 13, 2023 at 08:43 UTC | |
by choroba (Cardinal) on Nov 13, 2023 at 10:16 UTC | |
by GrandFather (Saint) on Nov 13, 2023 at 08:45 UTC | |
by Anonymous Monk on Nov 13, 2023 at 09:01 UTC | |
by Corion (Patriarch) on Nov 13, 2023 at 10:21 UTC | |
Re: arithmetic in a regex ?
by afoken (Chancellor) on Nov 13, 2023 at 09:24 UTC |