웹사이트 주소 - 정규 표현식 연습 사이트
https://regexr.com/39p0t
escape
-
기본적으로 url에는 /가 들어가기 때문에, 이에 대해 이것을 메타문자가 아닌, 일반 문자로 인식하게 하는 방법으로서 백슬래시를 앞에 추가시켜줘야 한다.
-
이에 대한 작업은 .에 대해서도 똑같이 작업해주는게 좋다.
http 및 https 주소 매칭
- ? : Quantifier. Match between 0 and 1 of the preceding token. -> 이전의 글자가 있든지 없든지 둘다 매칭 하는 방식으로 동작한다.
- . : Dot. Matches any character except line breaks.
- '+' : Quantifier. Match 1 or more of the preceding token.
http가 없는 특정 주소를 포함한 매칭
- webstie.com에 대한 패턴 매칭을 진행한다.
- () : Groups multiple tokens together and creates a capture group for extracting a substring or using a backreference.