how to find all not closed brackets using regex

Issue

how to find all not closed brackets using regex

Solution

Here is an example using a very narrowed-down version of your question.

const strings = [
  "[this is",
  "or [something] else",
  "[another]"
];
for (const string of strings) {
    // Regex = a "[" that is not followed by a "]"
    console.log(string, ' -- ', /\[(?!.*])/.test(string));
}

Answered By – David542

Answer Checked By – David Marino (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.