대부분 stringr
함수는 해당 stringi
함수의 래퍼입니다. str_replace_all
중 하나입니다. 그러나 내 코드는 stri_replace_all
, 해당 stringi
함수와 함께 작동하지 않습니다.str_replace/stri_replace에서 캡처 된 그룹 사용 - stringi vs stringr
저는 낙타의 경우 (일부분)를 이격 된 단어로 변환하는 빠른 정규 표현식을 작성하고 있습니다.
str <- "thisIsCamelCase aintIt"
stringr::str_replace_all(str,
pattern="(?<=[a-z])([A-Z])",
replacement=" \\1")
# "this Is Camel Case ain't It"
을 그리고 이것은하지 않습니다 :
나는이 작품 이유에 매우 의아해입니다
stri_replace_all(str,
regex="(?<=[a-z])([A-Z])",
replacement=" \\1")
# "this 1s 1amel 1ase ain't 1t"
하나의 옵션은 'stri_replace_all 것 (STR, 정규식 = "( = [(A-Z)]) (? = [A-Z])", 여분 = "")' – akrun