小编int*_*n14的帖子

正则表达式中的 R AND 运算符

我正在尝试获取一个包含大量段落的表达式,并在该行中找到包含两个特定单词的行,所以我正在寻找 AND 运算符?有什么办法可以做到这一点吗?

例如:

c <- ("She sold seashells by the seashore, and she had a great time while doing so.")
Run Code Online (Sandbox Code Playgroud)

我想要一个表达式来找到一行中同时包含“已售出”和“很棒”的行。

我尝试过类似的事情:

grep("sold", "great", c, value = TRUE) 
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

非常感谢!

regex operations r operator-keyword

1
推荐指数
1
解决办法
7381
查看次数

标签 统计

operations ×1

operator-keyword ×1

r ×1

regex ×1