로그인이나 회원가입.. 크롤링과 같이 어쩌다 한번 쓰던 정규 표현식.
게다가 어찌나 암호 코드처럼 생기셨는지.. 그래서 그냥.. 늘 구글링해서 복붙하던 정규 표현식은 관심 밖의 항목이었다.
그런데.. 최근 [파이썬, 통계]을 공부하면서 꾀 많이 쓰게 되어 여러모로 난감한 주제였는데..
주말.. 혼밥하면서 유튜브로 뭐 볼꺼 없나 검색하다.. 우연히 발견한 엘리님의 영상
정규표현식 , 더이상 미루지 말자
라는 제목에 뜨끔하여... 클릭해서 보게되었다. youtu.be/t3M6toIflyQ
오호~ 덕분에 정규식 완전 정복! 완전 강추
복습 : 위 주소 중에서 주소에 있는 키워드( ~ youtu.be/~~~~ ) 뽑기
https://www.youtu.be/-normalstory
http://www.youtu.be/-thinknormal
https://youtu.be/normal_story
youtu.be/think_normal
풀이 : 지극히 개인적인
1) 가장 경우의 수가 많은 샘플주소 적고 그룹 나누고 사용되지 않을 수도 있는 단어 뒤에? 붙이기
(https?://)(www.)youtu.be/(-normalstory|normal_story)
2) 특수 문자에 역슬러시 추가하기
(https?:\/\/)(www\.)youtu.be\/(-normalstory|normal_story)
3) 특정 단어를 [문자 범위] 및 {포함 개수}로 바꾸기
(https?:\/\/)(www\.)youtu.be\/([a-zA-Z0-9-]{12}|[a-zA-Z0-9]*_[a-zA-Z0-9]*)
4) 그룹 중에서 안쓰는 건 메모리에서 제외하기
(?:https?:\/\/)?(?:www\.)?youtu.be\/([a-zA-Z0-9-]{12}|[a-zA-Z0-9]*_[a-zA-Z0-9]*)
실습 : 브라우저 콘솔 console 에서 테스트
학습 레퍼런스
깃허브 github.com/dream-ellie/regex
dream-ellie/regex
Contribute to dream-ellie/regex development by creating an account on GitHub.
github.com
연습용 사이트 regexr.com/5mhou
RegExr: Learn, Build, & Test RegEx
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp).
regexr.com
추가 학습 추천 사이트 regexone.com/
RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs
Regular expressions are extremely useful in extracting information from text such as code, log files, spreadsheets, or even documents. And while there is a lot of theory behind formal languages, the following lessons and examples will explore the more prac
regexone.com




