Live data from Hacker News

Regex Golf

regex.alf.nu

61–70 of 189 posts

Re: Regex Golf

#61
post #6

what's the pattern on "Abba"? I thought it was just to exclude doubled letters but I have doubles on two words on the left hand side as well (noisefully and effusive, in case the word lists are the same)

well, if you are strictly interested in matching with the fewest characters, regardless of the apparent pattern:

  ^(.)(.).*\2\1$

Re: Regex Golf

#62
Many times I would match the exact opposite opposite of what I wanted. Is there a general rule for inverting regexps? ^ and ?! don't seem general purpose.

Re: Regex Golf

#63

Earlier quoted context omitted.

It gives you hints below the score, for 6 it's: You're allowed to cheat a little, since this one is technically impossible. No idea how you cheat... EDIT, SPOILERS: I get 170 with ^(.?)(.)(.).?\3\2\1$

176 with ^(.)(.).*\2\1$

  ^(.)[^p].*\1$           # 177, "cheat a little"

Re: Regex Golf

#64
post #20
post #7

[deleted]

This will earn you some more points: Anchors: k$ Ranges: [a-f]{4}

"sick" :) one for anchors. I was being quite complex with \w+(ick)$ Maybe I should read from right to left.

That ranges one was pretty obvious though. Stuck at abba.

Re: Regex Golf

#68
post #6

what's the pattern on "Abba"? I thought it was just to exclude doubled letters but I have doubles on two words on the left hand side as well (noisefully and effusive, in case the word lists are the same)

well, if you are strictly interested in matching with the fewest characters, regardless of the apparent pattern: ^(.)(.).*\2\1$

Your anchors at the end make it match nothing.

Re: Regex Golf

#70
post #11
post #6

what's the pattern on "Abba"? I thought it was just to exclude doubled letters but I have doubles on two words on the left hand side as well (noisefully and effusive, in case the word lists are the same)

Excluding doubled consonants that have the same vowel on both sides of the pair: ^((?!([aeiou])([^aeiou])\3\2).)*$ The following also works for the testcases and is shorter: ^((?!(.)(.)\3\2).)*$

Can get 2 more points with:

  ef|^((?!(.)\2).)*$
But I reckon yours wins for having a pair of breasts in the middle
Post reply on HN