如何用方括号替换字符串前后的引号?

How to replace quotation marks in front of and at the end of a string with brackets?

我正在尝试用 {} 之类的方括号替换引号。我需要为 bibtex 导入转换数据,这不适用于引号。它看起来像这样:

@article{NASIR20159,  
title = "Fault-tolerant context development and requirement validation in ERP systems",  
journal = "Computer Standards & Interfaces",  
volume = "37",  
pages = "9 - 19",  
year = "2015",  
issn = "0920-5489",  
doi = "https://doi.org/10.1016/j.csi.2014.05.001",  
url = "http://www.sciencedirect.com/science/article/pii/S0920548914000695",  
author = "S. Zafar Nasir and Tariq Mahmood and M. Shahid Shaikh and Zubair A. Shaikh",  
keywords = "Context development, Requirement validation, Enterprise Resource Planning, Fault tolerance, Data Mining",  
}

整个文件包含大约 2000 条这样的记录,加上我删除的摘要。我现在需要用方括号替换字符串前面和结尾的所有引号。最后它应该是这样的:

@article{NASIR20159,  
title = {Fault-tolerant context development and requirement validation in ERP systems},  
journal = {Computer Standards & Interfaces},  
volume = {37},  
pages = {9 - 19},  
year = {2015},  
issn = {0920-5489},  
doi = {https://doi.org/10.1016/j.csi.2014.05.001},  
url = {http://www.sciencedirect.com/science/article/pii/S0920548914000695},  
author = {S. Zafar Nasir and Tariq Mahmood and M. Shahid Shaikh and Zubair A. Shaikh},  
keywords = {Context development, Requirement validation, Enterprise Resource Planning, Fault tolerance, Data Mining},  
}

你知道我该怎么做吗?我试过 notepad++ 和多个替换表达式,但没有成功。

  • Ctrl+H
  • 查找内容:^.+?=\h*\K"(.+)"(?=,)
  • 替换为:{}
  • 检查 环绕
  • 检查 正则表达式
  • 取消选中 . matches newline
  • 全部替换

解释:

^           # beginning of line
  .+?       # 1 or more any character but newline, not greedy
  =         # equal sign
  \h*       # 0 or more horizontal spaces
  \K        # forget all we have seen until this position
  "         # double quote
  (.+)      # group 1, 1 or more any character but newline
  "         # double quote
  (?=,)     # positive lookahead, make sure we have a comma after

屏幕截图(之前):

屏幕截图(之后):