News for hackers. Stuff that matters.
Re:Is there a regular expression to detect a valid regular e... by nightfly on Sunday September 08, 2019 @02:01PM (#20912158)
)))((()(()
Re:Is there a regular expression to detect a valid regular e... by gerdesj on Sunday September 08, 2019 @05:59PM (#20913709)
When I check brackets by hand or manually I do actually get my hands out and when I say open I uncurl a finger, and when I say close, I furl a finger. "Open, open, open, close, open, close, close, close". Provided I have no fingers on display at the end, then the brackets are balanced. They might not be in the right place but at least they are balanced. If I find myself starting with close then I close the lid and go and do something else.

I'm sure some sort of rather cheap algorithm falls out of the above. It wont guarantee correctness in what the balanced brackets actually contain but they will at least be balanced.

Re:Is there a regular expression to detect a valid regular e... by sixstringtheory on Sunday September 08, 2019 @02:07PM (#20912210)
Good edge case. I’d say to immediately return an ‘unbalanced’ result once the count goes negative.
Re:Is there a regular expression to detect a valid regular e... by lioeters on Sunday September 08, 2019 @02:54PM (#20912570)
((((()
Re:Is there a regular expression to detect a valid regular e... by detaro on Sunday September 08, 2019 @02:56PM (#20912589)
doesn't end up with zero at the end, rejected?
Re:Is there a regular expression to detect a valid regular e... by lioeters on Sunday September 08, 2019 @06:29PM (#20913817)
I was just trying to suggest a possible edge case, a failing test.
Re:Is there a regular expression to detect a valid regular e... by jessaustin on Sunday September 08, 2019 @10:05PM (#20914653)
"never go negative"