marco.shaw has asked for the wisdom of the Perl Monks concerning the following question:
Using this, if $string doesn't have ".123" in it, I get the whole string output, but I don't want that. I just want the string output *if* it has ".123" at the end. I guess what I'm looking for is a test as to whether there's a ".0-9*" expression at the end. I need a ".", then any number of numerical values, but at least one. The "." has to be at the end.#!/usr/bin/perl my $string="testing.123"; my $result = substr( $string, rindex( $string, '.' ) + 1 ); print "$result\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Help with a regex
by grinder (Bishop) on Sep 07, 2007 at 14:46 UTC | |
Re: Help with a regex
by zer (Deacon) on Sep 07, 2007 at 14:23 UTC | |
Re: Help with a regex
by tirwhan (Abbot) on Sep 07, 2007 at 14:23 UTC | |
Re: Help with a regex
by ikegami (Patriarch) on Sep 07, 2007 at 14:48 UTC | |
Re: Help with a regex
by WiseGuru (Initiate) on Sep 08, 2007 at 08:27 UTC |
Back to
Seekers of Perl Wisdom