package test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Pattern pattern = Pattern.compile("(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]");
        Matcher isUrl = pattern.matcher("http://www.baidu.com");
        if(!isUrl.matches() ){
            System.out.println("非法!");
        }else{
            
        }
    }

}

相关文章:

  • 2021-12-12
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
  • 2021-09-11
  • 2021-12-31
  • 2022-02-18
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-12-16
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案