208: Regular Expressions

explain xkcd: It's 'cause you're dumb.
Revision as of 21:57, 31 December 2012 by 68.102.58.19 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Regular Expressions
Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee.
Title text: Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee.

[edit] Explanation

In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters.

Looking for a specific pattern on 200MB of text is an equivalent to "looking for a needle in a haystack" (Considering UTF-32 (32bits per character), this would be over 5 million characters. This task can be made easy by using "regexes", since they can find "match" a specific string pattern on the text.

Perl is a popular scripting language, and is especially well known for the flexible and simple regular expression features that it offers.

[edit] Trivia

This comic is featured on one of the T-shirts sold at the xkcd store

[edit] Transcript

Narrator: Whenever I learn a new skill I concoct elaborate fantasy scenarios where it lets me save the day.


Megan: Oh no! The killer must have followed her on vacation!
[Megan points to computer]
Megan: But to find them we'd need to search through 200MB of emails looking for something formatted like an address!
Cueball: It's hopeless!
Offpanel voice: Everybody stand back.
Offpanel voice: I know regular expressions.
[A man swings in on a rope, toward the computer]
tap tap
PERL!
[The man swings away, and the other characters cheer]
Comment.png add a comment!

Discussion

Hi, sorry about the previous "poor explanation". This one is pretty straight-forward (I think), given enough information about "regex"es and Perl. On a side-note, how did you find out the date for the comic? -- NariOx
The explanation was mostly accurate, my gripe was with the fact that a number of fields were empty - the transcript, date and categories weren't done. You can find the date in the "all comics" page, accessible from the sidebar. Davidy22[talk] 23:26, 29 November 2012 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
New Server Fund