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

217
Views
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 answers
Answer question

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 Report

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 Report

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 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!