崇高文本中的正则表达式效率不高

时间:2015-11-28 12:14:16

标签: json regex sublimetext3

我想找到并删除' indicent'使用sublime在我的json中的对象。这里是正则表达式

\s*+,\s*(.)+"\s*indices+"\s*:\s*+(.)\s*\s*(.)+\s*(.)+\s*+]

但是,它的堆栈空间不足。我认为正则表达式并不高效。

json示例:

           "created": "Fri Nov 27 11:12:43 +0000 2015",
            "text": "https://t.co/8r5dQ7zRYG #johnl3375 Kim Gi Jung",
            "source": "NOMOR1",
            "hashtags": [
                {
                    "text": "johnl3375",
                    "indices": [
                        24,
                        34
                    ]
                }
            ],
            "url": [
                {
                    "url": "https://t.co/8r5dQ7zRYG",
                    "expanded_url": "https://play.google.com/store/apps/details?id=com.aturkeuangan.nomor1#refid=johnl3375",
                    "display_url": "play.google.com/store/apps/det…",
                    "indices": [
                        0,
                        23
                    ]
                }
            ]

我希望json喜欢这个

            "created": "Fri Nov 27 11:12:43 +0000 2015",
            "text": "https://t.co/8r5dQ7zRYG #johnl3375 Kim Gi Jung",
            "source": "NOMOR1",
            "hashtags": [
                {
                    "text": "johnl3375"
                }
            ],
            "url": [
                {
                    "url": "https://t.co/8r5dQ7zRYG",
                    "expanded_url": "https://play.google.com/store/apps/details?id=com.aturkeuangan.nomor1#refid=johnl3375",
                    "display_url": "play.google.com/store/apps/det…"
                }
            ]

我的正则表达应该是什么?

1 个答案:

答案 0 :(得分:1)

这在ST3中使用您的JSON示例:[\s,]+"indices":[^]]+]

相关问题