Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
문제
풀이 후기
이 문제는.... 정규표현식을 공부하고 적용해보고 싶어서 계속 두고두고 풀기를 미루던 문제이다
생활코딩 정규표현식 강의를 계속 쫌쫌따리 들었었는데 내용 정리를 케이스 하나하나 다 해놓는다고 진도가 안나가서 작년부터 지금까지 끝내질 못했다
그런데 역시 실전에서 바로 써보는 것이 짱이다
어려워서 그냥 정답 코드 검색해서 정규표현식 부분만 참고해서 코드를 짰는데 강의 듣고 필기하던 것보다 백배는 이해가 빠르게 됐다
슬쩍 봤던 정답 코드들이랑 코드 길이부터 너무 차이나서 잘짠 코드인지는 모르겠다
그렇지만 정규표현식을 처음으로 실전에 사용해본 것만으로도 충분히 의미있었다
다른 사람의 풀이와 비교
좋아요 1등 풀이
_
는 포함 안해도 된다!\w
에 포함돼있기 때문이다^$
가 빈문자열이구나..! (^-시작, $-끝)repeat
..! 혹시나 해서a * 2
를 테스트 해봤는데NaN
이 나온다 문자열 반복에 쓸 수 있는 함수구나!좋아요 2등 풀이
\d
는 안써도 된다 숫자는\w
에 포함되어 있기 때문이다padEnd
를 이렇게 이용하다니..!^\.
는 없어도 된다 귀찮아서 위에꺼 복붙한 것일까