我想删除引号之间的所有文本。
我该如何做呢?
例子:
Bran could hear the wind in the trees, the clatter of their hooves on the ironwood planks, the whimpering of his hungry pup, but Jon was listening to something else. “There,” Jon said. He swung his horse around and galloped back across the bridge. They watched him dismount where the direwolf lay dead in the snow, watched him kneel. A moment later he was riding back to them, smiling. “He must have crawled away from the others,” Jon said. “Or been driven away,” their father said, looking at the sixth pup. His fur was white, where the rest of the litter was grey. His eyes were as red as the blood of the ragged man who had died that morning. Bran thought it curious that this pup alone would have opened his eyes while the others were still blind. “An albino,” Theon Greyjoy said with wry amusement. “This one will die even faster than the others.” Jon Snow gave his father’s ward a long, chilling look. “I think not, Greyjoy,” he said. “This one belongs to me.”
所需结果:
“There,” “He must have crawled away from the others,” “Or been driven away,” “An albino,” “This one will die even faster than the others.” “I think not, Greyjoy,” “This one belongs to me.”
或者
There, He must have crawled away from the others, Or been driven away, An albino, This one will die even faster than the others. I think not, Greyjoy, This one belongs to me.
答案1
- Ctrl+H
- 找什么:
(?:^|\G)[^“”]*(“[^”]*”)
- 用。。。来代替:
$1
(注意:前面有一个空格$1
) - 检查环绕
- 检查正则表达式
- Replace all
解释:
(?:^|\G) : non capture group, beginning of line or posiiton of last match
[^“”]* : 0 or more any character that is not “ or ”
( : start group 1
“ : opening “
[^“”]* : 0 or more any character that is not “ or ”
” : closing ”
) : end group
如果您不想在结果中使用引号,“([^”]*)”
则可以使用。(“[^”]*”)
替代品:
$1 : a space followed by content of group 1
给定示例的结果:
“在那里”,“他一定是从其他人那里爬走的”,“或者被赶走了”,“白化病”,“这个会比其他人死得更快。”“我想不是,葛雷乔伊”,“这个是我的。”
答案2
在库达文本编辑器,您可以通过多选来完成。
- 对话框查找,输入
".+?"
,检查 reg-ex 选项 - 在对话框中按“全选”
- 选中引号内的文本,复制到剪贴板
- 创建新文件选项卡,从剪贴板粘贴
要将结果行合并为一行,使用扩展库插件的命令“连接选定的行”。