Difference between revisions of "Talk:1313: Regex Golf"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(My Bad)
Line 35: Line 35:
  
 
I added a list of all US elected presidents and the part of the title regex they match. I used a python script to generate it, with input from [http://http://en.wikipedia.org/wiki/List_of_United_States_presidential_candidates here], then I removed all presidents that do not match after finding they really weren't elected. There may still be superflous ones, that weren't elected but do match the regex, please check. [[Special:Contributions/173.245.49.64|173.245.49.64]] 14:29, 6 January 2014 (UTC)
 
I added a list of all US elected presidents and the part of the title regex they match. I used a python script to generate it, with input from [http://http://en.wikipedia.org/wiki/List_of_United_States_presidential_candidates here], then I removed all presidents that do not match after finding they really weren't elected. There may still be superflous ones, that weren't elected but do match the regex, please check. [[Special:Contributions/173.245.49.64|173.245.49.64]] 14:29, 6 January 2014 (UTC)
 +
 +
Does anyone understand the final "No, I had those already"? Is it a reference to regexes in some way or could it be something like that there are infinite problems in life, even when not doing (Meta-)*-Regexes? --[[Special:Contributions/173.245.53.199|173.245.53.199]] 20:32, 6 January 2014 (UTC)

Revision as of 20:32, 6 January 2014

This is fairly simple fun little one.

Regex is sort for regular expressions. A regular expression is a series of characters that denotes a search criteria. For example, you could write a regular expression that would search for anything that looks like an address (a la comic 208).

Regex golf is a game in which you attempt to write a regular expression that will search through a list of items and bring back only those items that meet a certain criteria, but not anything else. The joke is that regular expressions are used to search text, but themselves are text strings. This means that you could write a regular expression that would look for another regular expression. You can then apply ad infinitum, and the universe implodes or something.

--Holshy (talk) 05:40, 6 January 2014 (UTC)

The last panel includes, of course, a regex "/(meta-)*regex golf/," which represents the phrase "regex golf" preceded by the phrase "meta-" up to infinite times.

As a punchline, it also refers to Jamie Zawinski's well-known quote about regex,

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

Thus, the punchline is that the addition of meta layers to regex golf generates more problems for the programmer, but that was also the setup of the comic. So either the punchline is really weak—worth a chuckle if you got the above two references—or I missed the joke. 199.27.128.63 06:22, 6 January 2014 (UTC)

Could anybody comment on the first regex? Do I get it right that beyond others it will match all strings that contain a "b"? I can hardly believe that is not the case for any star trek subtitle... 173.245.53.194 06:54, 6 January 2014 (UTC)

This is the case for all Star Trek Subtitles. Wikipedia's list of movies had no b. It'll match anything containing a word ending in m, any word beginning with n or t that is not the first word, or any word with a b. No Trek movies match. Oddly, so far as I can figure out, the regex in the first panel is wrong, in that it doesn't match the second Star Wars movie at all. And before you tell me prequels don't count, the sole purpose of "m " is to match The Phantom Menace.199.27.128.138 07:10, 6 January 2014 (UTC)

Attack of[ t]he Clones (to be read plainly, not as a regular expression). 173.245.53.107 07:29, 6 January 2014 (UTC)

Ah, I thought it was The Clone Wars. 199.27.128.138 15:36, 6 January 2014 (UTC)

So, if I add an "e" to the "tn" and delete the "|b" I'm a better golf player than her? 108.162.212.194 08:23, 6 January 2014 (UTC)

Or you could just move the "b" into the "tn" group. --11:08, 6 January 2014 (UTC)

I got a sneak preview of this comic at about 6:34 EST...at first it appeared to be random text in a irc message, but with this comic it now makes sense to me. Verticalbar (talk) 09:31, 6 January 2014 (UTC)

Regex golf (c.f. Perl golf) is a programming competition / is a pastime of finding regular expression that matches one set of strings while matching none of the other set. See for example http://regex.alf.nu --JakubNarebski (talk) 11:03, 6 January 2014 (UTC)

The title text isn't exactly true... I haven't tried everything, but that regex doesn't match "gerald ford" at all. 199.27.128.109 11:23, 6 January 2014 (UTC)

Gerald Ford wasn't elected, he became President following Nixon's resignation.

173.245.52.209 12:12, 6 January 2014 (UTC)

Inspired by regex.alf.nu, a reader built a page where the objective is to make a regular expression to match all Star Wars and no Star Trek: http://zegnat.github.io/xkcd1313/. 173.245.53.127 14:00, 6 January 2014 (UTC)

I added a list of all US elected presidents and the part of the title regex they match. I used a python script to generate it, with input from here, then I removed all presidents that do not match after finding they really weren't elected. There may still be superflous ones, that weren't elected but do match the regex, please check. 173.245.49.64 14:29, 6 January 2014 (UTC)

Does anyone understand the final "No, I had those already"? Is it a reference to regexes in some way or could it be something like that there are infinite problems in life, even when not doing (Meta-)*-Regexes? --173.245.53.199 20:32, 6 January 2014 (UTC)