devongovett / regexgen

Generate regular expressions that match a set of strings

Home Page:https://runkit.com/npm/regexgen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Repeating the same word in a string may produce a wrong result

mrkevinze opened this issue · comments

Can the input strings contain multiple words? I was presuming that they can, so I started trying it out.

This seems ok.

./cli.js "hi" "hi friend"
/hi(?: friend)*/

But this does not.

./cli.js "hey" "hi" "hi friend"
/h(?:i|ey)/

Hmm, first one seems wrong too. Should be ? instead of * there. I think there is a bug in the minimizer. Taking a look.

Fixed in 72ef1c2. Released in v1.2.0.