1

Twitter の @handle の前にある 2 つの単語を抽出したい

x <- c("this is a @handle", "My name is @handle", "this string has @more than one @handle")

次を実行すると、最後の@handleの前にあるすべてのテキストのみが抽出されます。すべての @handle に必要です。

(ext <- stringr::str_extract_all(x, "^.*@"))
[[1]]
[1] "this is a @"

[[2]]
[1] "My name is @"

[[3]]
[1] "this string has @more than one @"
4

1 に答える 1