블로그 이미지

calendar

1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
  • total
  • today
  • yesterday
2022. 8. 23. 14:18 JAVA언어

Pattern p = Pattern.compile("^(https?):\\/\\/([^:\\/\\s]+)(:([^\\/]*))?((\\/[^\\s/\\/]+)*)?\\/([^#\\s\\?]*)(\\?([^#\\s]*))?(#(\\w*))?$"); 
Matcher m =p.matcher(url);
if(m.find()) {
    m.group(1);
    m.group(2);
}

 

참조 : https://goodidea.tistory.com/86

posted by 천상의날개