• java udp地址匹配


    public static boolean regexUdpUrl(String url)
        {
            if (url == null)
                return false;
            Pattern pattern = Pattern
                    .compile("[udp]+[://]+((\d){1,})+\.((\d){1,})+\.((\d){1,})+\.((\d){1,})+:((\d){1,})");
            
            Matcher matcher = pattern.matcher(url);

            if(matcher.matches())
            {
          
                return Integer.valueOf(matcher.group(1))< 255
                        &&Integer.valueOf(matcher.group(3))<255
                        &&Integer.valueOf(matcher.group(5))<255
                        &&Integer.valueOf(matcher.group(7))<255
                        &&Integer.valueOf(matcher.group(9))<65536;

            }
            else
            {
                return false;
            }

        }

  • 相关阅读:
    zoj 3279 线段树 OR 树状数组
    fzu 1962 树状数组 OR 线段树
    hdu 5057 块状链表
    hdu3487 Play with Chain
    bzoj 1588营业额统计(HNOI 2002)
    poj2823 Sliding Window
    poj2828 Buy Tickets
    poj2395 Out of Hay
    poj3667 Hotel
    poj1703 Lost Cows
  • 原文地址:https://www.cnblogs.com/rspb/p/4618481.html
Copyright © 2020-2023  润新知