Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Regular expression

by dsb (Chaplain)
on Dec 09, 2005 at 18:39 UTC ( #515620=note: print w/ replies, xml ) Need Help??


in reply to Re: Regular expression
in thread Regular expression

Well, one problem is neither of your regex will match your string; the first will match strings which include 0-9 seven times in succession; the second will match seven consecutive copies of 0-9 or 0- or any combination of these; neither will match 7 random digits.
I'm not sure why you are saying that, but the OP's first pattern WILL match 7 random digits. The second will also match 7 random digits, but it will also match 1-6 random digits as well.

Unfortunately, the OP is a bit unclear as to whether this sequence of 7 numbers should be isolated or part of a larger string.


dsb
This @ISA my( $cool ) %SIG


Comment on Re^2: Regular expression
Re^3: Regular expression
by swampyankee (Parson) on Dec 09, 2005 at 22:18 UTC

    The square braces weren't there when I wrote my reply; I think g0n inserted the code tags after my comment. 0-90-9... does look a bit different from [0-9][0-9]; and I managed to get confused.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2015-07-06 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls