Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: RegEx to match unique string of digits

by lodin (Hermit)
on Jun 05, 2009 at 03:23 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-29 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found