balanced-match icon indicating copy to clipboard operation
balanced-match copied to clipboard

Broken regex implementation

Open stevemao opened this issue 8 years ago • 7 comments

do you support this use-case?

If the str contains more a than b / there are unmatched pairs, and a and/or b is regex, what's the expected behaviour?

stevemao avatar Jul 16 '16 12:07 stevemao

i think this should be covered by your other pull requests already, right?

also if you want, i'd be happy to add you as a collaborator on this project

juliangruber avatar Jul 18 '16 10:07 juliangruber

I don't think this is covered? Which one did you refer to?

Happy to contribute to this anyhow 😄

stevemao avatar Jul 18 '16 10:07 stevemao

doesn't this cover that?

If the str contains more a than b / there are unmatched pairs, the first match that was closed will be used. For example, {{a} will match ['{', 'a', ''] and {a}} will match ['', 'a', '}'].

juliangruber avatar Jul 18 '16 10:07 juliangruber

Oh not with a or b as regex. Also that was just a missing test.

BTW just realise you didn't enable travis.

stevemao avatar Jul 18 '16 10:07 stevemao

This is supposed to be a failure test.

stevemao avatar Jul 18 '16 10:07 stevemao

i enabled travis now, no clue why it was disabled...

juliangruber avatar Jul 18 '16 10:07 juliangruber

Basically regex only works for very simple use-cases. In order to support all, I think it will be very complicated and performance might be questionable.

stevemao avatar Jul 18 '16 11:07 stevemao