Skip to main content
ratans6128
May 20, 2023
Question

Check for balanced parentheses

  • May 20, 2023
  • 2 replies
  • 0 views

Given an expression string exp, write a program to examine whether the pairs and the orders of

"{","}","(",")","[","]"
are correct in exp.

For example, the program should print true for

exp = "[()]{}{[()()]()}"
and false for

exp = "[(])"

    2 replies

    stefanhelzle0001
    Brainy
    May 20, 2023

    Do you have any specific question?

    mikes0011
    Brainy
    May 21, 2023

    You should be able to do this, I expect, with a fairly complex Regex Match expression (since it can check not only for patterns but repetitions of patterns).