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

211
Views
Regex to match the data between the double quotes

I have below strings

1. "Settings Icon": "xxhdjxxx7wn"
2. "Settings Icon": "afewfwl"
3. "Settings Icon": "fdj ssde"

I want the regex to match all these strings by ignoring the content in right side of colon

I have (['"])(?:(?!\1|\\).|\\.)*\1 which matches with content inside double quote. But couldn't solve above case.. Please help

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

0

If I understand you're question correctly, you only want the string within the quotes, from the left side of the colon. Is that correct? If so, this might work for you:

(['"])([^\1]*?)\1:.*$

For this expression, capture group 2 will give you what you want.

about 4 years ago · Juan Pablo Isaza Report

0

Use

const string = `1. "Settings Icon": "xxhdjxxx7wn"
2. "Settings Icon": "afewfwl"
3. "Settings Icon": "fdj ssde"`

console.log( string.match(/(?<=")[^"]+(?=":)/g) )

DEMO

enter image description here

EXPLANATION

--------------------------------------------------------------------------------
  (?<=                     look behind to see if there is:
--------------------------------------------------------------------------------
    "                        '"'
--------------------------------------------------------------------------------
  )                        end of look-behind
--------------------------------------------------------------------------------
  [^"]+                    any character except: '"' (1 or more times
                           (matching the most amount possible))
--------------------------------------------------------------------------------
  (?=                      look ahead to see if there is:
--------------------------------------------------------------------------------
    ":                       '":'
--------------------------------------------------------------------------------
  )                        end of look-ahead

See regex proof.

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!