Mastering Regular Expressions, 2nd Edition by Jeffrey E. F. Friedl This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated September 13, 2004. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: pxviii, IN PRINT: second-to-last paragraph; "Understanding the details of how a regular expressions are handled... " SHOULD BE: "Understanding the details of how regular expressions are handled... " p11, IN PRINT: second-to-last line; "..., it they would be the... " SHOULD BE: "..., they would be the... " p25, IN PRINT: ...look at this example again in Chapter 5 (=> 194). SHOULD BE: ...look at a similar example in Chapter 5 (=> 194). p25, IN PRINT: center para, and in subsequent command line [-a-z0-9_:@&?=+,.!/~*'%$]* SHOULD BE [-a-z0-9_:@&?=+,.!/~*%$]* p28, IN PRINT: last paragraph "...include Python, many Java regex package, Microsoft's .NET... " SHOULD BE "...include Python, many Java regex packages, Microsoft's .NET... " p35, IN PRINT: 2nd to last line; "Perl (as well...) tend to provide... " SHOULD BE: "Perl (as well...) tends to provide... " (39) bottom of the page; As it turns out (at least on some systmes), Perl's simple print is sometimes not... should be: As it turns out (at least on some systems), Perl's simple print is sometimes not... p40, IN PRINT: second paragraph; "The is are now much nicer " SHOULD BE: "The result is now much nicer " p51, IN PRINT: 2nd paragraph above letter to Tom Cruise; "... each substitution to replacements them all, not just one. " SHOULD BE: "... each substitution to replace them all, not just one. " p58, IN PRINT: line 3; "print "From: Jeffrey Friedl \n"; " SHOULD BE "print "From: jfriedl\@regex.info (Jeffrey Friedl)\n"; " p63, IN PRINT: Figure 2-7; Matched while checking lookahead Result of lookahead SHOULD BE: Matched while checking lookbehind Result of lookbehind p63, IN PRINT: Table 2-1, 3rd row; "...at which a comma is inserted. " SHOULD BE: "...at which an apostrophe is inserted. " p79, IN PRINT: First sentence of (5); "...marked all the doubled words, we want keep only logical... " SHOULD BE: "...marked all the doubled words, we want to keep only logical... " p80, IN PRINT: third paragraph; "Still, the task of showing the concepts is made a bit easier due to a unique feature of Perl among advanced languages that regular expressions are a "first class," low-level feature of the language. " SHOULD BE: "Still, the task of showing the concepts is made a bit easier due to a Perl feature unique among advanced languages, which is that regular expressions are a "first class", low-level feature of the language. " p84, IN PRINT: last sentence of second paragraph; "...next chapter is devoted to it. " SHOULD BE: "...next chapter is devoted to them. " (88), 4th para Printed: which could be freely incorporate by others Fixed: which could be freely incorporated by others (94) last paragraph; In the second sentence beginning with "An integrated approach", the phrase "some of mechanics" should be "some of the mechanics". p97, IN PRINT: first paragraph; "each was just chosen by the developers who happened to have thought was the best approach at the time " SHOULD BE: "each was just chosen by the developers who thought it was the best approach at the time. p113, IN PRINT: toward bottom of 2nd section; [.span-ll.]]> SHOULD BE: [.span-ll.]] p114, IN PRINT: 2nd-to-last para; "... some of the control shorthands they... " SHOULD BE: "... some of the character shorthands they... " p123, IN PRINT: 2nd-to-last para; "...may seem a bit odd a first... " SHOULD BE: "...may seem a bit odd at first... " p135, IN PRINT: first para; "turns `C:\WINDOWS\' into `C:\\WINDOWS\\' " SHOULD BE: "turns `C:\WINDOWS\' into `C\:\\WINDOWS\\' " AUTHOR'S NOTE: This changes makes the statement technically correct, at the cost of slighly muddling the point. p136, table, 2nd row The table should note that GNU Emacs supports, within the replacement string, \& to represent the text of the entire match, and \1, \2, etc. for parenthesized submatches. (138) IN PRINT: 6th paragraph, under Conditional, last sentence in parentheses; "The else part my be..." SHOULD BE: "The else part may be..." p139, 3rd-last-para Printed: can used as the if test. Fixed: can be used as the if test. p160, first line Printed: Let's look a simple example Fixed: Let's look at a simple example p165, last paragraph before heading Printed: Actually, there's could be... Fixed: Actually, there could be... (173) 2nd paragraph; The incorrect atomic grouping regex is currently (?>\\"|[^"])*+ but it should be (?>\\"|[^"])* (the last + should be removed). Additionally, "as if" in the second to last sentence should be "like". {176} 1st paragraph, 3rd sentence; "...and it is invariably a mistake." should be: "...and it is invariably a mistake when used with a Traditional NFA." 197 boxed text reads: 2x\"3\" should be: 2x"\3\" (201) IN PRINT: Last sentence, 2nd paragraph; "...could case a very rude surprise..." SHOULD BE: "...could cause a very rude surprise..." {212} 2nd paragraph; IN PRINT: @zips = m/\G(?:(?!44)\d\d\d\d\d)*(44\d\d\d\d)/g; SHOULD BE: @zips = m/\G(?:(?!44)\d\d\d\d\d)*(44\d\d\d)/g; The expression (44\d\d\d\d) is a six-digit expression. You need a five-digit expression to stay in sync with the string of five-digit zip codes, and to capture the zip codes correctly. p226, 2nd para Printed: This is a big savings. Fixed: This is big savings. (228) IN PRINT: 1st paragraph, 2nd line; "...performance of a regex like can tell you..." SHOULD BE: "...performance of a regex like this can tell you..." p232, first bullet Printed: ...or other setup that must done, do it before... Fixed: ...or other setup that must be done, do it before... p240, footnote Printed: For example, I might insert in at the marked... Fixed: For example, I might insert it at the marked... p244, last line Printed: (which is fast way to search... Fixed: (which is a fast way to search... p246, fourth line Printed: Similar optimizations involves \A, ... Fixed: Similar optimizations involve \A, ... p280, mid-page Printed: match: 1> at the very start... Fixed: match: 1) at the very start... p305, last code snippet Printed: perl -e 'print qr/\b \w+ \b/x, "\n"' Fixed: perl -e 'print qr/\b \w+ \b/ix, "\n"' (320), 2nd-to-last para Printed: Normally, the replacement operator is evaluated... Fixed: Normally, the replacement operand is evaluated... (321) 6th paragraph; "That example splits the target string on a single character, but it you can split on..." should read: "...but you can split it on..." p325, first bullet point Printed: ("s", "h", "o", &bigmidddot, "s", "t") Fixed: ("s", "h", "o", ..., "s", "t") p325, second bullet point Printed: It's almost the same as \s+, except that leading whitespace is skipped. Trailing whitespace is ignored as well if an appropriately large (or negative) chunk-limit operand is given. Fixed: It's almost the same as \s+, except that leading whitespace is skipped. p339, 2nd-to-last paragraph Printed: ...Programming Perl and Object Oriented Perl show discuss why... Fixed: ...Programming Perl and Object Oriented Perl discuss why... (340) IN PRINT: 2nd paragraph, last sentence; "...skeleton the expression:" SHOULD BE: "...skeleton of the expression:" p341, fifth line Printed: Adding these items to skeleton expression gives us: Fixed: Adding these items to the skeleton expression gives us: p351, first line Printed: Not all regex operands can be cached. Consider this snippet: Fixed: Not all regex operands can be cached directly. Consider this snippet: p359, mid-page Printed: ...is found. On most systems, ... Fixed: ...is found. (On most systems, ... p371, last line of code snippet Printed: .findNext(); (3) , (5) Fixed: .findNext(); // (3) , (5) (400) end of first para. Should be a full stop not a comma. p407, fifth paragraph Printed: The following examples all which work with... Fixed: The following examples all work with... p408, mid-page snippets Three occurances of "Subject" within a quoted string are italicized. They shouldn't be. (416), last para Printed: ...dispense with the MatchCollection variable altogether Fixed: ...dispense with the MatchCollection object altogether 417, ".Replace" example Printed: Text = R_CapWord.Replace(Text, "$1") Fixed: Text = R_CapWord.Replace(Text, "$0") 424, 2nd to last para Printed: ..where in the target text the match was found. Fixed: ..where in the target text the group match was found.