如何使用正则表达式从 JSON 字符串中删除大括号?

How do I remove curly braces from JSON strings using regular expression?

您好,我有这个 JSON 文件,我想从 chapters 数组的字符串中删除花括号,但是如果这个花括号包含超过 3 个单词(花括号内有 2 个空格),我想删除完整的花括号。是否可以使用正则表达式?

 {
    "abbrev": "gn",
    "name": "Genesis",
    "chapters": [
        [
            "And the earth was without form, and void; and darkness {was} upon the face of the deep. And the Spirit of God moved upon the face of the waters.",
            "And God said, Let there be light: and there was light.",
            "And God saw the light, that {it was} good: and God divided the light from the darkness. {the light from...: Heb. between the light and between the darkness}",
            "And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day. {And the evening...: Heb. And the evening was, and the morning was etc.}",
            "And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters. {firmament: Heb. expansion}"
        ]
 ] }

我试着用消极的眼光来解决,结果不尽如人意。如果它不能用正则表达式解决它在 javascript?

中的解决方案是什么

我不明白为什么你不能使用 2 个正则表达式解决这个问题:

var regex1 = /{[^{}]+[ ][^{}]+[ ][^{}]+}/g;
var regex2 = /[{}]/g;

var str = ...;
str = str.replace(regex1, "");
str = str.replace(regex2, "");