http://qs321.pair.com?node_id=768654


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.