Contents

조회 수 932 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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

예) 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);



?

  1. 맥에서 포트 확인하고 닫기 (mac)

    Date2022.03.22 CategorySystem/OS Byhooni Views1189
    Read More
  2. 서버 확장을 위한 두 가지 방법

    Date2018.08.29 CategorySystem/OS Byhooni Views2249
    Read More
  3. [ios] Requesting Location Permissions in iOS

    Date2018.08.18 CategoryDevelop Byhooni Views1722
    Read More
  4. [mysql] ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    Date2017.12.15 CategoryDatabase Byhooni Views1362
    Read More
  5. [linux] 초간단 Postfix, Covecot, SSL/TLS (SMTP)

    Date2017.12.11 CategorySystem/OS Byhooni Views9492
    Read More
  6. [ios] Facebook SDK 로그인 설명

    Date2017.04.19 CategoryDevelop Byhooni Views1298
    Read More
  7. [ios] NSString, RegularExpression Find/Replace

    Date2017.04.14 CategoryDevelop Byhooni Views932
    Read More
  8. [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column

    Date2017.03.30 CategoryDatabase Byhooni Views8912
    Read More
  9. [ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법

    Date2017.03.29 CategoryDevelop Byhooni Views1069
    Read More
  10. Mac OS 에 Jenkins 설치하기 (Homebrew)

    Date2017.03.15 CategoryDevelop Byhooni Views8375
    Read More
  11. [ios] 동영상 플레이어 샘플 (for PIP Player)

    Date2017.03.15 CategoryDevelop Byhooni Views1392
    Read More
  12. [ios] Facebook Cache 갱신하는 함수

    Date2017.02.27 CategoryDevelop Byhooni Views1305
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7