devongovett / regexgen

Generate regular expressions that match a set of strings
https://runkit.com/npm/regexgen
3.35k stars 100 forks source link

Sort alternation options #14

Closed devongovett closed 7 years ago

devongovett commented 7 years ago

Fixes #10. Flattens alternations so that a single node may have more than 2 options, and sorts the options by length. This is necessary since regex alternations short circuit: they return the first matching option, not necessarily the longest.

devongovett commented 7 years ago

@mathiasbynens