punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
I have a collection of strings of the general form:
abunchofalphanumericcharacters_somenumbers
That is, a bunch of whatever that may contain letters, numbers, undescors, dashes and what have you, then a final series of numbers. Two examples:
asdf_sadf-3i897sdyf33987
3w45t-wevt453_838475693
I want to capture the final string of numbers after the last non-numerical character, in these cases 33987 and 838475693. Note that the last non-numerical character may be a letter (a-z, either case) or an undescor or a dash, or any number of other non-whitespace characters. The strings contain no whitespace.
But how?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex: find all trailing numerical digits in a string
by dragonchild (Archbishop) on Dec 06, 2004 at 17:42 UTC | |
|
Re: Regex: find all trailing numerical digits in a string
by VSarkiss (Monsignor) on Dec 06, 2004 at 17:58 UTC | |
by Fletch (Bishop) on Dec 06, 2004 at 18:09 UTC | |
by osunderdog (Deacon) on Dec 06, 2004 at 19:49 UTC | |
by dragonchild (Archbishop) on Dec 06, 2004 at 19:53 UTC | |
by Fletch (Bishop) on Dec 06, 2004 at 20:36 UTC | |
|
Re: Regex: find all trailing numerical digits in a string
by punch_card_don (Curate) on Dec 06, 2004 at 18:25 UTC |