Editing 208: Regular Expressions

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 4: Line 4:
 
| title    = Regular Expressions
 
| title    = Regular Expressions
 
| image    = regular_expressions.png
 
| image    = regular_expressions.png
| titletext = Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee!
+
| titletext = Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee.
 
}}
 
}}
  
 
==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.
+
In computing, {{w|regular expression}}s ("regexes") provide a concise and flexible{{Citation needed}} 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.
+
Manually trying to look for a specific pattern through 200MB 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 [http://www.google.com/cse?cx=012652707207066138651%3Azudjtuwe28q&ie=UTF-8&q=perrl&siteurl=xkcd.com%2F&ref=&ss=1112j354976j5&oq=perrl&gs_l=partner.3...4805.5949.0.6245.5.5.0.0.0.0.316.1024.0j2j2j1.5.0.gsnos%2Cn%3D13...0.1112j354976j5..1ac.1.25.partner..3.2.276.Ewyu_zKGkDo#gsc.tab=0&gsc.q=perl 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.
 +
 
 +
The title text refers to how sensitive regexes can be to small missing characters. In [[1168: tar]] another potential hero fails because some programming languages are just too difficult to remember by heart.
  
 
==Transcript==
 
==Transcript==
:[in a yellow box:]
 
 
:Whenever I learn a new skill I concoct elaborate fantasy scenarios where it lets me save the day.
 
: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: Oh no! The killer must have followed her on vacation!
 
:[Megan points to computer.]
 
:[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!
+
:Megan: But to find them we'd have to search through 200MB of emails looking for something formatted like an address!
 
:Cueball: It's hopeless!
 
:Cueball: It's hopeless!
  
Line 28: Line 33:
  
 
:''tap tap''
 
:''tap tap''
:The word ''PERL!'' appears in a bubble.
+
:''PERL!''
  
 
:[The man swings away, and the other characters cheer.]
 
:[The man swings away, and the other characters cheer.]
  
 
==Trivia==
 
==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.".
+
*This comic is featured on one of the [http://shop.xkcd.com/products/i-know-regular-expressions T-shirts] sold at the xkcd store.
  
 
{{comic discussion}}
 
{{comic discussion}}
 
 
[[Category:Comics featuring Cueball]]
 
[[Category:Comics featuring Cueball]]
 
[[Category:Comics featuring Megan]]
 
[[Category:Comics featuring Megan]]
 
[[Category:Comics with color]]
 
[[Category:Comics with color]]
 
[[Category:Regex]]
 
[[Category:Regex]]
[[Category:Comics with xkcd store products]]
 

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)