Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: RegEx to match unique string of digits

by lodin (Hermit)
on Jun 05, 2009 at 03:23 UTC ( #768654=note: print w/replies, xml ) Need Help??


in reply to RegEx to match unique string of digits

GrandFather's suggestion of filter out the false matches afterwards is probably sufficient for you, and perhaps also more efficient (but do a Benchmark to be certain if time efficiency is an issue). However, maybe you need this in a larger pattern, and then you can use a negative look-ahead to avoid the mono-digit strings.

$_ = '2222222222 1234567890 123 0000000000 48192049281924 999999999999 +99'; print "$2\n" while /\b(?!(\d)\1+\b)(\d{10,}\b)/g; __END__ 1234567890 48192049281924

lodin

Replies are listed 'Best First'.
Re^2: RegEx to match unique string of digits
by simulantx (Initiate) on Jun 05, 2009 at 03:37 UTC
    Awesome suggestions everyone. I'll run some Benchmarks for sure and see how it works against my data. THANKS!
      RegEx always seems to drive me nuts when I am trying to work on a project! Once I get the right expression(s) though, it is amazingly powerful :) My last project was for ISAPI URL rewrites.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-01-23 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?