From d160e10b021524e7e561be76ea35e14f2bb96125 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sun, 5 Jul 2009 07:16:56 -0400 Subject: [PATCH] changed Perl 5 reference --- regular-expressions.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regular-expressions.html b/regular-expressions.html index b6e72ad..72d2340 100644 --- a/regular-expressions.html +++ b/regular-expressions.html @@ -24,7 +24,7 @@ body{counter-reset:h1 4}

If your goal can be accomplished with string methods, you should use them. They’re fast and simple and easy to read, and there’s a lot to be said for fast, simple, readable code. But if you find yourself using a lot of different string functions with if statements to handle special cases, or if you’re chaining calls to split() and join() to slice-and-dice your strings, you may need to move up to regular expressions.

Regular expressions are a powerful and (mostly) standardized way of searching, replacing, and parsing text with complex patterns of characters. Although the regular expression syntax is tight and unlike normal code, the result can end up being more readable than a hand-rolled solution that uses a long chain of string functions. There are even ways of embedding comments within regular expressions, so you can include fine-grained documentation within them.

-

If you’ve used regular expressions in other languages (like Perl 5), Python’s syntax will be very familiar. Read the summary of the re module to get an overview of the available functions and their arguments. +

If you’ve used regular expressions in other languages (like Perl, JavaScript, or PHP), Python’s syntax will be very familiar. Read the summary of the re module to get an overview of the available functions and their arguments.