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

Re: Matching numeric value between two digits

by 7stud (Deacon)
on Feb 05, 2013 at 02:11 UTC ( #1017044=note: print w/replies, xml ) Need Help??


in reply to Matching numeric value between two digits

Also rather than the clumsy /\d{1}-\d{2}/ you might wish to use /[0-9]+/

Of course, those regexes don't match the same things:

use strict; use warnings; use 5.012; my $str = "8-91"; if ($str =~ /(\d{1}-\d{2})/) { say $1; } if ($str =~ /([0-9]+)/) { say $1; } --output:-- 8-91 8
The op's regexes don't make much sense.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017044]
help
Chatterbox?
[karlgoethebier]: had his first oysters this year for lunch - with some really white wine. Great
[karlgoethebier]: choroba: this drink makes blind...
[erix]: handy, no blindfold needed

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-09-25 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?