Latest revision |
Your text |
Line 1: |
Line 1: |
| {{comic | | {{comic |
| | number = 208 | | | number = 208 |
− | | date = January 10, 2007 | + | | date = |
− | | title = Regular Expressions | + | | title = |
− | | image = regular_expressions.png | + | | image = |
− | | titletext = Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee! | + | | imagesize = |
| + | | titletext = |
| }} | | }} |
| | | |
| ==Explanation== | | ==Explanation== |
− | The comic begins with [[Randall]] saying how every time he develops a new skill, he finds himself daydreaming about using it to save the day. Computer skills aren't usually superhero material, which lends itself to the humor of the comic. In computing, a {{w|regular expression}} ("regex") provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Manually trying to look for a specific pattern through 200 MB of text is equivalent to looking for a needle in a haystack. But this task can be made easy by using regexes, since a script can read through text and match specific string patterns much faster than humans can achieve. {{w|Perl}} is a popular scripting language that has often been referenced favorably in the comic. Perl is also the most acknowledged language when it comes to the performance while evaluating regular expressions. The "PERL!" in the fifth panel is reminiscent of old superhero serials, particularly {{w|Batman (TV series)}}, in which sound effects such as "BAM!" "POW!" "ZAP!" would be displayed on screen in similar spiky bubbles. This fits with the theme of the comic, with Cueball being a "superhero" who fights crime using computer skills.
| + | According to Wikipedia: "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." |
| | | |
− | The title text refers to how sensitive regexes can be to small mistakes or missing characters. In [[1168: tar]], another potential hero fails (and gets blown up by a nuclear bomb that is only able to be disarmed by typing in a valid tar command, but blows up if you don't do it on the first try) because the syntax of some commands and programming languages are just too difficult to remember by heart.
| + | 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, specially useful when dealing with strings. |
| | | |
| ==Transcript== | | ==Transcript== |
− | :[in a yellow box:]
| + | <!-- The transcript can be found in a hidden <div> element on the xkcd comic's html source, with id "transcript". |
− | :Whenever I learn a new skill I concoct elaborate fantasy scenarios where it lets me save the day.
| + | -- Tip: Use colons (:) in the beginning of lines to preserve the original line breaks. |
− | | + | -- Any actions or descriptive lines in [[double brackets]] should be reduced to [single brackets] to avoid wikilinking |
− | :Megan: Oh no! The killer must have followed her on vacation!
| + | -- Do not include the title text again here --> |
− | :[Megan points to computer.]
| |
− | :Megan: But to find them we'd have to search through 200 MB of emails looking for something formatted like an address!
| |
− | :Cueball: It's hopeless!
| |
− | | |
− | :Off-panel voice: Everybody stand back.
| |
− | | |
− | :Off-panel voice: I know regular expressions.
| |
− | | |
− | :[A man swings in on a rope, toward the computer.] | |
− | | |
− | :''tap tap''
| |
− | :The word ''PERL!'' appears in a bubble.
| |
− | | |
− | :[The man swings away, and the other characters cheer.]
| |
− | | |
− | ==Trivia==
| |
− | This comic used to be [https://web.archive.org/web/20160422073536/http://shop.xkcd.com:80/products/i-know-regular-expressions available as a T-shirt] in the xkcd store before it was [[Store|shut down]]. There was also a [https://web.archive.org/web/20220125010600/https://store.xkcd.com/products/try-science similar T-shirt] based on this comic says "Stand back... I'm going to try science.".
| |
| | | |
− | {{comic discussion}} | + | ==Trivia |
| + | This comic is feature on one of the T-shirts[http://shop.xkcd.com/products/i-know-regular-expressions] sold at the xkcd stoe |
| + | {{comic discussion}} |
| | | |
− | [[Category:Comics featuring Cueball]]
| + | <!-- Include any categories below this line--> |
− | [[Category:Comics featuring Megan]]
| + | Regular |
− | [[Category:Comics with color]]
| |
− | [[Category:Regex]]
| |
− | [[Category:Comics with xkcd store products]]
| |