Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public void validateNickname(String nickname){
throw new BaseException(BaseResponseStatus.CONSECUTIVE_HYPHEN_NICKNAME);
}

// 한글 영어가 아닌 것으로 시작
if (nickname.matches("^[^A-Za-z가-힣ㄱ-ㅎㅏ-].*")) {
// 한글, 영어, 숫자가 아닌 것으로 시작

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

리포지토리 스타일 가이드 8번 규칙에 따르면, 모든 주석에는 작성자 이름과 날짜가 포함되어야 합니다. 이 규칙을 이 주석과 110번 줄의 주석 등 파일 내 다른 유사한 주석들에도 적용하는 것을 고려해 보세요. 예를 들어: // 한글, 영어, 숫자가 아닌 것으로 시작 // author, YYYY-MM-DD

References
  1. Each comment must include the author's name and the date. (link)

if (nickname.matches("^[^A-Za-z가-힣ㄱ-ㅎㅏ-ㅣ0-9].*")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

정규식에서 한글 문자 범위를 나타내는 가-힣ㄱ-ㅎㅏ-ㅣ 대신 \p{IsHangul}을 사용하는 것을 고려해 보세요. \p{IsHangul}은 유니코드 속성을 사용하여 모든 한글 문자를 포괄하므로, 코드가 더 간결해지고 가독성이 향상됩니다. 또한, 향후 유니코드 표준 변경에도 더 유연하게 대응할 수 있습니다.

        if (nickname.matches("^[^A-Za-z\p{IsHangul}0-9].*")) {

throw new BaseException(BaseResponseStatus.INVALID_START_OF_NICKNAME);
}

// 한글 영어가 아닌 것으로 마무리
if (nickname.matches(".*[^A-Za-z가-힣ㄱ-ㅎㅏ-]$")) {
// 한글, 영어, 숫자가 아닌 것으로 끝남
if (nickname.matches(".*[^A-Za-z가-힣ㄱ-ㅎㅏ-ㅣ0-9]$")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

106번 줄의 제안과 마찬가지로, 여기에서도 가-힣ㄱ-ㅎㅏ-ㅣ 대신 \p{IsHangul}을 사용하여 정규식을 개선할 수 있습니다. 일관성을 위해 파일 내 다른 정규식(예: 116번 줄)에도 동일한 변경을 적용하는 것을 추천합니다.

        if (nickname.matches(".*[^A-Za-z\p{IsHangul}0-9]$")) {

throw new BaseException(BaseResponseStatus.INVALID_END_OF_NICKNAME);
}

Expand Down