Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
how to extract an array from a string in javascript

i have a string which contains array in it and bracket , i want to extract data from it .

    let vr = "- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API."

how can i dynamically identify if an array is present in this string , like take [Next.js Documentation] since it is an array. Please help me on this issue

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

You can use regex with javascript's String.prototype.match().

The regex pattern to match anything enclosed by brackets is /\[(.*?)\]/gm. You can check here.

Good luck!

about 4 years ago · Juan Pablo Isaza Denunciar

0

let vr = "- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API."
const regex = /\[([^\]]+)\]\(([^)]+)\)/g;
let match;
let result = [];
while ((match = regex.exec(vr)) !== null) {
  result.push(match[1]);
}
console.log(result);

about 4 years ago · Juan Pablo Isaza Denunciar

0

let vr = "- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API."

const re = /\[([^]*?)]/g;
let match = re.exec(vr);
if (match !== null) {
    console.log(match[1]);
} else {
    // not matched
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda