Hi, I'm trying to write a RegEx that will match 6 or 7
adjacent digits
surrounded by non-digits, lazily.
I currently have:
\D\d{6,7}\D
Which will match, for example "-123456*", but I
want it to match but
NOT capture the non-digits. I tried:
\D?\d{6,7}\D?
to make the non-digits optional, but this didn't work.
My ideal RegEx will return the following matches:
1234567
123456
from (for example):
Blah 1234567* blah123456) 12345 blah 12345678()blah
So that only the 6 or 7 digits are captured, and only if the
6 or 7
digits are surrounded immediately by non-digits.
Hope someone can point me in the right direction!
Plankmeister.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regex googlegroups.com
To unsubscribe from this group, send email to
regex-unsubscribe googlegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---
|