Regex Golf

This is a super fun site of regular expression challenges. You have to match all the words in the left column but none of them in the right.
http://regex.alf.nu/

I haven’t done all of them since they take a while, and they get really hard really quickly.
My best scores:
Plain strings (207)
Anchors (206)
Ranges (202)
Backrefs (198)
Abba (14) <- I hate you
A man, a plan (177)
Prime (185)
Four (190)
Order (79)
Triples (84)

Since it’s in javascript it even supports full regex instead of Lua’s trimmed down version, which is even better =D

That was fun :3
I haven’t used regular expressions too much outside roblox, so it took a while to “learn” stuff that is not included in Lua’s version :Q

I felt like I cheated on some parts (mostly the later levels), but here’s what I got

1 Like

I can’t figure out the best way to do the prime one. I know this matches a few of the “do not match” ones, and misses the first one in “match”, but it makes sense. I’d like to see better solutions.

^(xx)+x$

It just matches as many pairs of “x” at the beginning of the string as possible, and then one more. That has to be the whole string (meaning I’m just matching an odd number of “x”).