Live data from Hacker News

Regex Golf

regex.alf.nu

101–110 of 189 posts

Re: Regex Golf

#101
Glob (333) without cheating (replace ⁕s with asterisks, they get turned into italics):

^(\⁕?)(\w⁕)(\⁕?)(\w⁕)(\⁕?)(\w⁕) .⁕ ((.(?!\1))+|\1)\2((.(?!\3))+|\3)\4((.(?!\5))+|\5)\6$

Edit: ((.(?!\1))+|\1) is used to conditionally match .+ iff a * has been found. .(?!\1) Matches any character if it is followed by \1. When * has been found then it matches no character, when * is not found it matches every character.

Edit 2: Formatting to avoid the *s becoming italics :/

Re: Regex Golf

#103
Ternstroemiaceae contains four es; anyone else hit that issue / know what that's not in the valid results for Four? I'm guessing there's a pun in there that I didn't get :/

Re: Regex Golf

#105
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.

  5.  193  ^(?!.*(.)(.)\2\1)
  11. 379  ^\*(er|[fiptv])|^([blpw]|c[hor]|do|mi|re)

Re: Regex Golf

#106

Does anybody know how to do math with regex? (triples) And conditionals don't seem to work?

I got 187 with this

  [369](?![7238])|(?:0)12
It's sloppy and certainly not correct, but a decent score.

Re: Regex Golf

#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
Post reply on HN