Comment by dequeued on 27/01/2021 at 23:33 UTC*

3 upvotes, 1 direct replies (showing 1)

View submission: Reintroducing the /r/AutoModerator wiki!

View parent comment

The UK part is unfortunately better suited for warning people to verify phone numbers rather than alerting on doxing. I adapted it from a regex I'm using on /r/personalfinance for that purpose. I'll try to add a caveat of some sort.

If you need a broader regex, I'd probably start with the Ofcom documentation rather than Wikipedia:

https://www.ofcom.org.uk/__data/assets/pdf_file/0013/102613/national-numbering-plan.pdf

Of course, if you are just trying to match numbers for a specific region or city, that's a **much** easier problem.

Edit: I improved the regex and tested it out on some data from UK subreddits. I think it will catch *most* regional numbers provided that the number starts with the 01 or 02 prefix. If you need to go after local numbers that lack one of the supported prefixes then I'd recommend adding a custom regex.

Replies

Comment by [deleted] at 27/01/2021 at 23:51 UTC

2 upvotes, 1 direct replies

Cheers. Yes, I just linked the Wikipedia article as a quick summary. Pity Ofcom wouldn't publish a specimen regex that covers the entire numbering syntax. At some point I'll see can I come up with something to match the geographic ranges.