小编Fel*_*mes的帖子

哪个正则表达式从文本中的引号中删除标点符号

我有一个数据库,整个文本中都有一些用引号引起来的引号。我想删除所有的点“。” 在文本中用引号引起来。

我有将标点符号放在文本中的代码,但是如果有多个引号或多个点,则仅删除第一个。

# Simple phrase:
string <- '"é preciso olhar para o futuro. vou atuar" no front '

# Code that works for a simple 1-point sentence:
str_replace_all(string, '(\".*)\\.(.*\")','\\1\\2')

# Sentence with more than one point and more than one quote:
string <- '"é preciso olhar para o futuro. vou atuar" no front em que posso 
fazer alguma coisa "para .frente", disse jose.'

# it doesn't work as i would like
str_replace_all(string, '(\".*)\\.(.*\")','\\1\\2')
Run Code Online (Sandbox Code Playgroud)

我希望删除引号中的所有要点,但是从示例中可以看出,我开发的正则表达式不适用于更一般的情况。

regex r stringr

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

标签 统计

r ×1

regex ×1

stringr ×1