1
$\begingroup$

this is a not workable code to test whether bracket is legal:

("(({{[[]]}})" //. {"{}" -> "", "[]" -> "", "()" -> ""}) == ""

I want to know that how to make Rule have the same effect as StringReplace

$\endgroup$
0
5
$\begingroup$

How about doing this instead of adapting RepaceRepeated:

FixedPoint[
  StringReplace[{"{}" -> "", "[]" -> "", "()" -> ""}]
, "(({{[[]]}})"
] === ""
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.