Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

Hi I have this JSON file I want to remove the curly braces from inside the strings in the chapters array, but if this curly braces contain more than 3 words (2 spaces inside the curly braces), I want the complete curly brace to be deleted. Is it possible with Regular expression?

 {
    "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}"
        ]
 ] }

I tried solving with negative look ahead, unsatisfactory results. And if its not possible with Regular expression what would be the solution for it in javascript?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I don't see why you couldn't solve this using 2 regexes:

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

var str = ...;
str = str.replace(regex1, "");
str = str.replace(regex2, "");
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!