Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda