Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


This right here is why test cases are always blackboxed...


Makes my similarly off-track score of 184 seem foolish:

  ^[a-g][^airn]|[fs].*y$|ot$


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

I must say Regex golf is a lot of fun.


Nice, turn it around for 199:

  ^.{5}[^e]?$


or ^[^o].{1,5}$

198 points


Balance (194)

  ^<.*>$|^<<.*>>$|^<<<.*>>>$


Balance (286)

  ^(<(<(<(<(<(<<>>)*>)*>)*>)*>)*>)*$
If we had named captures:

  ^(((?<P><)|(?<-P>>))*(?(P)(?!)))$


Balance (288) with one bad match: ^(<(<(<(..)>)>)>)$


Balance (212)

[<>]{28}


Four: 199

    (.)(.\1){3}
Order: 168

    ^a*b*c*d*e*f*g*h*i*l*m*n*o*p*r*s*t*w*y*z*$
(You just didn't remove unused letters.)


Order for 195

    ^[a-g]*[^a-g]*$


Order for 170.

  ^([ab][c-gio][^d]|c[ehlo]|d|f[il]|gh|mo)
Not as clever as you guys though!


Order for 196:

    ^[a-i]*[l-z]*$


Or just (.).\1.\1.\1 for Four (198)


So long as we are going down this route, you can shave off another character with (.)(.\1){3} (199).


Can chop out one check to save a character:

(.)...\1.\1




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: