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

149
Views
¿Cómo obtener todas las palabras en una cadena que comienza con '{' y termina con '}' en Javascript?

Soy nuevo en expresiones regulares. Tengo esto :

 '@time-transform{ [bg:red;c:white] [bg:black] [bg:white;c:black] }'

Quiero la parte dentro de corchetes.

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

0

Puede dividir la cadena por expresiones regulares:

 const result = input.split(/({|})/)[2];
about 4 years ago · Juan Pablo Isaza Report

0

Parece que también se puede hacer sin expresiones regulares aunque.

 const text = '@time-transform{[bg:red;c:white][bg:black][bg:white;c:black]}'; const result = text.substring(text.indexOf('{') + 1, text.indexOf('}')); console.log(result); // logged: '[bg:red;c:white][bg:black][bg:white;c:black]' (string)
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!