• 请不要在回答技术问题时复制粘贴 AI 生成的内容
jianen
V2EX  ›  程序员

你能正确写出判断 IP 合法性的正则表达式吗?

  •  
  •   jianen · Dec 5, 2014 · 3438 views
    This topic created in 4217 days ago, the information mentioned may be changed or developed.
    干脆利落编写正则表达式,判断IP的合法性,需要考虑各种情况,比如下面的IP为非法:
    01.123.123.123
    0.0.0.0、255.255.255.255(保留地址)
    等等各种异常情况~~

    进阶:
    编写正则表达式判断内网ip,公网ip,非法ip。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5481 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:53 · PVG 15:53 · LAX 00:53 · JFK 03:53
    ♥ Do have faith in what you're doing.