I have this regular expression to look for phone numbers in a codebase:
\d{3}[.s-]?d{3}[.s-]?d{4}g
How can I modify this so that it will not match instances where the number is preceded or followed by a digit?
18005555555 (should not match)
80055555551 (should not match)
"8005555555" (should match)
s800-555-5555 (should match)
8005555555 (should match)
800.555.5555 (should match)
Edit:
I'm not trying to "match the whole word", because it is not sufficient that the match is preceded by and followed by a space. See the 3rd example of above that should also return a match.
I want to match only instances where the match is not preceded or followed by a digit.
In others words:
[NOT DIGIT][PHONE NUMBER][NOT DIGIT]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…