我想在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