For the string ((!@#)), the shortest match for the pattern "("~~__~~")" should be "(!@#)", but
StringCases["((!@#))", Shortest["(" ~~ __ ~~ ")"]]
Returns with ((!@#). What went wrong with my code? Thanks!
For the string ((!@#)), the shortest match for the pattern "("~~__~~")" should be "(!@#)", but
StringCases["((!@#))", Shortest["(" ~~ __ ~~ ")"]]
Returns with ((!@#). What went wrong with my code? Thanks!
The question suggests a solution with
Except[]. The complete suggested solution is :StringCases["((!@#))", Shortest["(" ~~ Except["("] .. ~~ ")"]]– andre314 Dec 26 '15 at 13:44