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

182
Views
Regex to get 2 characters between other 2 characters and not include specific text in between

I've asked similar question before, yet running into deeper issues that I'm hoping to fix. I'm trying to indentify a specific scenario with Regex.

Link to previously asked question: Previous question and answer

In the example bellow my goal is the remove brackets around second (second can be any other word):

content = [](first-(second))

I've been recommended to use the following method:

content.replace(/(?<=\]\()(.*)(?=\))/g, (x) => x.replace(/[()]/g, '')):

Perfect outcome: [](first-second)

It worked until I ran into another string that looked like this:

content = ([](first-(second)))

Outcome: ([]first-(https)

I think my goal now is to add a condition, that checks if the word is equal to https then don't touch it. If you have a better option to deal with this, I would be glad to hear it.

about 4 years ago · Juan Pablo Isaza
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!