我想在R中的stringr中使用str_view
來查找以「y」開頭的所有單詞以及以「x」結尾的所有單詞。我有一個由Corpora生成的單詞列表,但每當我啓動代碼時,它都會返回一個空白視圖。將str_view與R中的單詞列表一起使用
Common_words<-corpora("words/common")
#start with y
start_with_y <- str_view(Common_words, "^[y]", match = TRUE)
start_with_y
#finish with x
str_view(Common_words, "$[x]", match = TRUE)
另外,我想發現只有3個字母長的話,但沒有 想法而已。
請提供[MCVE(最小完全可驗證例)](http://stackoverflow.com/help/mcve) 。 –
對不起,你認爲最小的完整可驗證的例子是什麼意思? – Rfanatic
該鏈接解釋了它? :)'str_view(s,'^ y(。)* x $')' – Gopala