Regex Golf
41–50 of 189 posts
Re: Regex Golf
#42Re: Regex Golf
#43I 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*$
^[^o].....?$
Probably not what was wanted, but it works (or maybe it was to trick people onto a false path)Re: Regex Golf
#44am I being a bit slow? Why doesn't [^g-z] work on 'ranges'?
Because for example "beam" matches [^g-z] . That is, it has a letter somewhere that is not between g and z (namely e and a ). I came up with ^[a-f]+$ but I'm guessing it could be shorter :) Edit: ah, every word in left column has 4 a-f letters. So [a-f]{4} is a shorter match.
Re: Regex Golf
#45am I being a bit slow? Why doesn't [^g-z] work on 'ranges'?
Because for example "beam" matches [^g-z] . That is, it has a letter somewhere that is not between g and z (namely e and a ). I came up with ^[a-f]+$ but I'm guessing it could be shorter :) Edit: ah, every word in left column has 4 a-f letters. So [a-f]{4} is a shorter match.
Re: Regex Golf
#46I hit enter and nothing happens.
This confused me for a few minutes.
Re: Regex Golf
#47(.+|)foo(.+|) Lol so awesome this. I oblige. Much love!
^((((((((((x)\10?)\9?)\8?)\7?)\6?)\5?)\4?)\3?)\2?)\1?$
I feel like there's gotta be a sneakier way of doing this.Re: Regex Golf
#48Earlier quoted context omitted.
Backrefs (201): (...).*\1
Wait, so what's with the 'point system' here? Why's shdon answer for backrefs 199 and yours 201? (and while you're at it, could you briefly explain (...).*\1 for the regex newbies?)
(...) # Match exactly 3 (the dots) characters and save them as a group (the parenthesis)
.* # Match any character (the dot) 0 or more times (the asterisk)
\1 # Reuse the first groupRe: Regex Golf
#49Re: Regex Golf
#50Shouldn't the objective be to get the lowest score if it's called "golf?"
The goal in code golf is lower character count, not lower score - which is also the case here.
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 task. Final score would be how many characters under or over the total character limits (course par) you scored.
Seems this is more like Regex Darts or something like that.
But it's fun nonetheless.