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.