Live data from Hacker News

Regex Golf

regex.alf.nu

71–80 of 189 posts

Re: Regex Golf

#71

(.+|)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.

Mine is a bit shorter, though a bit more "meh" as well.

    ^x{32}$|^(x{2}){1,8}$|^(x{64})+$|^x$

Re: Regex Golf

#73

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

My guess is that 147 must appear the same number of times as 258, but I'm not sure if that's even expressible in regexp.

Re: Regex Golf

#74
post #50

Earlier quoted context omitted.

The goal in code golf is lower character count, not lower score - which is also the case here.

Therefore, the score it provides should be a running tally of how many characters you've used to make it match the scoring system of golf; which is the lowest number of strokes wins. The scoring system for this is incremental which is the opposite of golf. A proper scoring system with this would provide a character limit (par) for each section and the goal would be to write a shorter regex formula to complete the tas…

I don't get what this is all about.

The title was (most probably) derived from Code Golf, which is a competition in coding something with as few characers as possible. Code Golf was derived from Golf, where you want to use as few turns as possible.

The score going up and not down, which is done because you get more points the more objectives you fulfill, does not change the objective of this game or what it is based on.

Re: Regex Golf

#76

  ^(?!(..+)(\1)+$)
Why does that work on primes? I got it by mistake when fiddling with the parenthesis locations but I was expecting to have to deal with xx separately.

Re: Regex Golf

#77
post #50

Earlier quoted context omitted.

Therefore, the score it provides should be a running tally of how many characters you've used to make it match the scoring system of golf; which is the lowest number of strokes wins. The scoring system for this is incremental which is the opposite of golf. A proper scoring system with this would provide a character limit (par) for each section and the goal would be to write a shorter regex formula to complete the tas…

I don't get what this is all about. The title was (most probably) derived from Code Golf, which is a competition in coding something with as few characers as possible. Code Golf was derived from Golf, where you want to use as few turns as possible. The score going up and not down, which is done because you get more points the more objectives you fulfill, does not change the objective of this game or what it is based…

> The score going up and not down, which is done because you get more points the more objectives you fulfill, does not change the objective of this game or what it is based on.

Golf scoring penalizes you with more "points" by how many strokes you take.

If you are playing a Par 4 and it takes you 6 swings to get in the cup you just got _penalized_ +2

If your partner gets in the cup in 2 swings he is awarded -2

Therefor "Regex Golf" has its scoring reversed

Re: Regex Golf

#79

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.

You need to pin the match to the start and end of the string with ^ and $ respectively otherwise the negation just matches an empty string or other irrelevant string.

Re: Regex Golf

#80

I have the most trouble with regex, and something about seeing my matches as I type made this incredibly useful for me!

http://regexpal.com/ or for a paid desktop program http://www.regexbuddy.com/ , which is most excellent

Regexbuddy is great. Well worth the coin I paid way back when
Post reply on HN