如何防止论坛出现大量垃圾邮件机器人?

Ah I see, we can maybe come up with something more specific that will avoid shorter codes… perhaps:

\b\d{3}[-.\s]\d{3}[-.\s]\d{4}\b

This will catch formats like 1-800-123-4567, 123 456 7890

If it’s more like +1 123 456 7890, this might work better to specifically catch the +1

\+1[-.\s]\d{3}[-.\s]\d{3}[-.\s]\d{4}

Neither of these will get false positives for shorter codes like 123-4567

5 个赞