Re:Show HN: RegEx Face Off – Beat your friends with regular ...
by wwwigham on Saturday December 31, 2016 @08:37AM
(#13290941)
My strategy of "capture the last two characters of each input in the accept group followed by $" hasn't failed yet, and is quick to input and requires no thought. Though I wouldn't say I'm practicing any practical RegEx skills doing so. :P
[ Parent
| on HN ]
Re:Show HN: RegEx Face Off – Beat your friends with regular ...
by pepijndevos on Saturday December 31, 2016 @09:29AM
(#13291139)
My strategy was ^[].*[^]$ where you first fill in all the first letters of the match words and then all the last characters of the skip group. Works fairly well.
I'm not sure if there is a length limit, but I'm fairly sure I could come up with a vim macro/regex that would allow me to copy the match words and make a (list|like|so) within 45 seconds.
Give the time limit, it would be more fun to automatically let your strategy compete. (maybe with a weight of length vs correctness) Write a function that, given two arrays of words, return the best regex.
Re:Show HN: RegEx Face Off – Beat your friends with regular ...
by ygra on Saturday December 31, 2016 @10:32AM
(#13291413)
> Write a function that, given two arrays of words, return the best regex.
I've actually done that with code-golf in the past. I needed a regex shorter than n that would match what I wanted it to match, so I generated valid regexes up to n length and tested them. A bit brute-force, but eventually saved me one character in the program.
Re:Show HN: RegEx Face Off – Beat your friends with regular ...
by impostervt on Saturday December 31, 2016 @09:37AM
(#13291182)
I think you just beat me at my own game.
Re:Show HN: RegEx Face Off – Beat your friends with regular ...
by impostervt on Saturday December 31, 2016 @08:44AM
(#13290971)
There are a few questions that this strategy won't work on already. Guess I'll have to think up some more.