Notepad ++替换功能

时间:2018-08-29 09:51:19

标签: replace notepad++ notepad

可以以某种方式自动替换为该结果:

初始:

"eye","doc":441,"engagement":35877,"impression":1987869,"reach":294757,"repost":441}}

结果:

{"emojiAnnotations":{"eye","doc":441,"engagement":35877,"impression":1987869,"reach":294757,"repost":441}}

当“眼睛”等是变量时......(仅标题相同)?

我想使用-类似于-“ *”,“ doc”用{“ emojiAnnotations”:“ *”,“ doc”替换(作为表达式),但这不会保留变量“ eye”等

建议。这是替换过程的一部分,因此一开始就不能添加

1 个答案:

答案 0 :(得分:1)

这样可以吗?

  • Ctrl + H
  • 查找内容:"[^"]+","doc"
  • 替换为:{"emojiAnnotations":{$0
  • 检查环绕
  • 检查正则表达式
  • 全部替换

说明:

"[^"]+"     : 1 or more not quote beweeen quotes
,"doc"      : literally

替换:

{"emojiAnnotations":{   : literally
$0                      : the whole match

给定示例的结果

{"emojiAnnotations":{"eye","doc":441,"engagement":35877,"impression":1987869,"reach":294757,"repost":441}}