Contents

Views 946 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

정규표현식으로 문자열 교체하는 예제

예) Kakao 계정에서 닉네임에 이모티콘 있을 시 제거하는 내용

NSString *pattern = @"[^\uAC00-\uD7A3xfe0-9a-zA-Z\\s]";
NSString *kakaoNickname = @"123 &1245; Hooni Test!!^^";

NSError *error = nil;
NSRegularExpression *regex =
    [NSRegularExpression regularExpressionWithPattern:pattern
        options:NSRegularExpressionCaseInsensitive error:&error];

NSString *modifiedString =
    [regex stringByReplacingMatchesInString:kakaoNickname options:0
        range:NSMakeRange(0, [kakaoNickname length]) withTemplate:@""];

NSLog(@"kakaoNickname : %@", modifiedString);



?

List of Articles
No. Category Subject Author Date Views
84 System/OS 맥에서 포트 확인하고 닫기 (mac) hooni 2022.03.22 1200
83 System/OS 서버 확장을 위한 두 가지 방법 file hooni 2018.08.29 2259
82 Develop [ios] Requesting Location Permissions in iOS file hooni 2018.08.18 1728
81 Database [mysql] ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. hooni 2017.12.15 1371
80 System/OS [linux] 초간단 Postfix, Covecot, SSL/TLS (SMTP) file hooni 2017.12.11 9505
79 Develop [ios] Facebook SDK 로그인 설명 file hooni 2017.04.19 1320
» Develop [ios] NSString, RegularExpression Find/Replace hooni 2017.04.14 946
77 Database [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column 3 hooni 2017.03.30 8946
76 Develop [ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법 file hooni 2017.03.29 1079
75 Develop Mac OS 에 Jenkins 설치하기 (Homebrew) 2 file hooni 2017.03.15 8385
74 Develop [ios] 동영상 플레이어 샘플 (for PIP Player) file hooni 2017.03.15 1394
73 Develop [ios] Facebook Cache 갱신하는 함수 file hooni 2017.02.27 1320
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7