Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Help with a regex

by WiseGuru (Initiate)
on Sep 08, 2007 at 08:27 UTC ( [id://637803]=note: print w/replies, xml ) Need Help??


in reply to Help with a regex

try

my $string="testing.123";
my @Strings;
@Strings=split(/\./,$string);
if($Strings[$#Strings] eq "123"){ DoSomething.... }

this way you have got the last chunk of the string divided by a period, always, because if there is more than one period then you might not get what you want, but if you have ONLY ONE period and can garrantee it, then use

my $string="testing.123";
my $string2;
($string,$string2)=split(/\./,$string);
if($string2 eq "123"){ DoSomething.... }

good luck!

www.arobcorp.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://637803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found