정보 정규식 - 활용 - 웹 주소
페이지 정보
본문
https://sir.kr/cm_quiz/10905 에 있던 것입니다.
포인트는 주소에 www가 있는 경우와 없는 경우도 체크해야 되고. http와 https도 체크하고..
(?<http>http(?:s)?:\/\/)(?<www>www.)?(?<domain>(?:[a-z0-9\w]+\.*)+[a-z0-9]{2,4})(?<remain>\/data\/editor\/[^\.]+\.(?:png|jpg|jpeg|gif|webp))
(?<http> : 그룹네임이 http 이라는 것입니다.
(?:s)? 그룹 캡쳐하지 말고 s가 있을 수도 있고 없고 s?로 써도 되네요.
그룹네임 http, www, domain, remain 이렇게 4개를 캡쳐합니다.
그누보드내의 이미지 디렉토리 /data/editor 내의 모든 이미지 파일을 매칭시키면서 각각의 그룹을 통해서 쉽게 조작이 가능합니다.
추천5 비추천0
댓글목록


