崇高文本中的正则表达式效率不高
Regex in sublime text is not efficient
我想使用 sublime 在我的 json 中查找并删除 'indicent' 对象。这是正则表达式
\s*+,\s*(.)+"\s*indices+"\s*:\s*+(.)\s*\s*(.)+\s*(.)+\s*+]
但是,运行 出栈 space。我认为正则表达式效率不高。
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…"
}
]
我的正则表达式应该是什么?
使用您的 JSON 示例,这在 ST3 中对我有用:[\s,]+"indices":[^]]+]
我想使用 sublime 在我的 json 中查找并删除 'indicent' 对象。这是正则表达式
\s*+,\s*(.)+"\s*indices+"\s*:\s*+(.)\s*\s*(.)+\s*(.)+\s*+]
但是,运行 出栈 space。我认为正则表达式效率不高。
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…"
}
]
我的正则表达式应该是什么?
使用您的 JSON 示例,这在 ST3 中对我有用:[\s,]+"indices":[^]]+]