r - 我想要在包含使用 R 的文本的列中的第一个句号之后的单词
问题描述
我想要第二句话的文字。
text="I need to go to mall today. I want to purchase clothes. Also, I want to buy shoes."
预期结果:
I want to purchase clothes. Also, I want to buy shoes.
解决方案
我们也可以stringr::str_match
用来捕获第一个点之后的所有内容。
stringr::str_match(text, "\\.(.*)")[, 2]
#[1] " I want to purchase clothes. Also, I want to buy shoes."
[, 2]
是获取捕获组。
推荐阅读
- node.js - 如何使用节点 pg 在 ejs 中呈现 postgresql 结果?
- flutter - Flutter 在流回调中修改外部变量
- django - DateInput - 输入一个有效的日期
- javascript - 我的用于获取某个范围内的值的递归解决方案如何真正起作用?
- python - 无法查看 jpeg 文件
- c# - 注销时未清除声明
- php - php://input 在 GET 时始终为空
- line - 如何在 shopify 中创建一个类似于下面附加的设计的 html 行分隔符?
- node.js - 在 post web service bill 中查找现有的 id 对象
- javascript - Electron showMessageBox 不阻塞进程