toRegex() 함수 사용

fun main() {

    var testRegex = """[\D]""".toRegex();
    println(testRegex.replace("!@#57 -/312\$F 1ASD1326 450 !~",""))

    var test = "!@#57 -/312\$F 1ASD1326 450 !~";
    print(test.replace("[\\D]", ""))

}

 

자바처럼 사용하면 작동이 되지 않는다

 

regex101.com/r/FIXIWL/1/

 

Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript

Please wait while the app is loading...

regex101.com

 

'Programming Language > kotlin' 카테고리의 다른 글

코틀린 스프링 부트 연습  (0) 2020.11.17
코틀린 kotlin 기초  (0) 2020.11.16

+ Recent posts