Live data from Hacker News

Regex Golf

regex.alf.nu

121–130 of 189 posts

Re: Regex Golf

#121
post #102

Gist with my answers: https://gist.github.com/jpsim/8057500 If you look at the revisions, you'll see my 1st iteration was mostly identifying patterns, then with more and more cheating (and looking at this thread) to squeeze every point possible.

https://gist.github.com/jonathanmorley/8058871

3121 points

Re: Regex Golf

#122

(.+|)foo(.+|) Lol so awesome this. I oblige. Much love!

Powers: ^((((((((((x)\10?)\9?)\8?)\7?)\6?)\5?)\4?)\3?)\2?)\1?$ I feel like there's gotta be a sneakier way of doing this.

Completely not sneaky at all, but does reasonably well at 71 points:

  ^(x|xx|xxxx|x{8}|x{16}|x{32}|(x{64})+)$

Re: Regex Golf

#123
post #113
post #110

I figured out Ranges! abac|accede|adead|babe|bead|bebed|bedad|bedded|bedead|bedeaf|caba|caffa|dace|dade|daff|dead|deed|deface|faded|faff|feed Edit: /s

Prime: ^x{2,3}$|^x{5}$|^x{7}$|^x{11}$|^x{13}$|^x{17}$|^x{19}$|^x{23}$|^x{29}$|^x{31}$|x{33}

josephlord's solution is much nicer:

^(?!(..+)(\1)+$)

Re: Regex Golf

#128
post #90

Earlier quoted context omitted.

From: http://quaxio.com/triple/ ^([0369]|[258][0369]*[147]|[147]([0369]|[147][0369]*[258])*[258]|[258][0369]*[258]([0369]|[147][0369]*[258])*[258]|[147]([0369]|[147][0369]*[258])*[147][0369]*[147]|[258][0369]*[258]([0369]|[147][0369]*[258])*[147][0369]*[147])*$

569pts: ([^31]0|31|[017]2|[03]03|[^1]4|(900|01|7)5|6|[48]7|[57]8|09)$

Originally had 568, then saw this and improved. :)

580pts: 00(0$|3|6|9|12|15)|[^0]14|.53|^3[^38]|55|43|23|9.7

Re: Regex Golf

#129
post #43
post #31

I got Four for 196 with (.).*\1.\1.*\1 and Order for 156 with ^a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*$

Order for 198: ^[^o].....?$ Probably not what was wanted, but it works (or maybe it was to trick people onto a false path)

Nice, I earned 197 with: ^[a-m].{1,5}$

I must say Regex golf is a lot of fun.

Post reply on HN