Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Perl Regex

by Kenosis (Priest)
on Nov 15, 2012 at 05:25 UTC ( #1003932=note: print w/replies, xml ) Need Help??


in reply to Perl Regex

Here's an option:

use strict; use warnings; my $string = "/qwjhj/sdvbb/vuvs/tryt3687fbhvh/vv1vh/382411"; my ($number) = $string =~ /(\d+)$/; print $number;

Output:

382411

Regex:

my ($number) = $string =~ /(\d+)$/; ^ ^ ^^ | | || | | |+ - End of the string | | + - End capture | + - One or more digits + - Begin capture

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003932]
help
Chatterbox?
[Corion]: marto:I hope you're well
[marto]: Corion crazy busy at the moment, with work (and a tpue), the kids and some external factors
[marto]: hopefully everything is good with you

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2017-02-24 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (353 votes). Check out past polls.