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

158
Views
Regex Grouping Stepped Explanation
let quotedText = /'([^']*)'/;
console.log(quotedText.exec("she said 'hello'"));
//["'hello'", "hello"]

why does hello appear twice?

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

0

The first element in the result is the full match, and the second element is the first captured group. Remove the parentheses () to get only one result.

let quotedText = /'[^']*'/;
console.log(quotedText.exec("she said 'hello'"));

If you still want to keep the parentheses, you can use a non-capturing group as shown below:

let quotedText = /'(?:[^']*)'/;
console.log(quotedText.exec("she said 'hello'"));

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!