Errata

Introducing Regular Expressions

Errata for Introducing Regular Expressions

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date Submitted
PDF multiple places in the book

Do you plan to provide updates as some of web pages changed significantly. E.g. RegExr do not implement DOTALL option.

Mike Mettler  May 26, 2020 
PDF Page 34
hapter "Quoting a Group.....

I found \Q\E not working nor in most specifications of regex. Is it limited e.g. to Perl implementation only?
Even page RegExr is not explaining those two tags.

Mike Mettler  May 26, 2020 
Printed Page 1
sample line of code

Erratum for "Introducing Regular Expressions", Fitzgerald, 2012

I wish to submit what I think is an error in the 2012 edition of Fitzgerald's "Introducing Regular Expressions".

Sorry to be seven years late.

The beginning example of a regular expression in chapter one, intended to match a phone number, uses a <start of line> symbol '^' twice, and I can make no sense of the second occurrence:

^(\(\d{3}\)|^\d{3}[.-]?)?\d{3}[.-]?\d{4}$ --> page 1

I would think the first occurrence covers both options inside the ( ), and the second use would only succeed if the preceding line was empty, giving two line beginnings in a row.

Simplified correction:

^(abc|def) rather than ^(abc|^def)


Hal Day
halday@frontier.com

ps
I greatly enjoyed your Catch-22 joke re. the typo in the URL to find the errata, which one can find if one goes to the errata.

Henry P. Day, Jr.  Dec 03, 2019 
Printed Page 15
1st line

Unable to download,

Are you forcing users to a particular browser?

Anonymous  Apr 02, 2018 
Printed Page 76
Table 7-2

The quantifier + should be same as {1, } as shown on page 75 rather than {1, 0} as shown in the table entry.

Anonymous  Feb 01, 2018 
Printed Page 37
Displayed Perl command

Same mistake as the previous submitted displayed sed command erratum -- inconsistent displayed command with the command found in top.pl file.

Anonymous  Feb 01, 2018 
Printed Page 36
Displayed sed command

The sed command output should be <title>Rime</title> instead of <title>The Rime of the Acyent Mariner (1798)</title> if the reader were to type out the command. The title "The Rime of the Acyent Mariner (1798)" is found inside the file top.sed which is inconsistent with the sed command diaplayed.

Anonymous  Feb 01, 2018 
Printed Page 8
Regex sample in first paragraph, as already submitted, but not confirmed at 2012-09-01

The given regex pattern does not match all strings as described in the first sentence of the page "Finally, here is...". The original regex is this:
^(\(\d{3}\)|^\d{3}[.-]?)?\d{3}[.-]?\d{4}$

(1) The way the first capturing group is made up, only non-parenthesised region-codes may be separated from the rest of the phone number string via dot/hyphen; this may be intended, but seems odd (note: i am not familiar with notation of US phone numbers). This leads to "(707)-827-7019" not being matched by the given regex pattern.

(2) The starting caret is used inconsistently/redundantly, the very first occurence should suffice, as it is outside of the first capturing group; the usage after the "|" metacharacter within this capturing group does not add an additional restriction.

Note (1) could be fixed by (a) doubling up the optional first separator, or by (b) nesting two character group patterns within the first character group. The caret usage mentioned in note (2) might create misleading assumptions by the reader and should be straightened.

My suggestions for this regex would be:
(a) ^(\(\d{3}\)[.-]?|\d{3}[.-]?)?\d{3}[.-]?\d{4}$
(b) ^((\(\d{3}\)|\d{3})([.-])?)?\d{3}[.-]?\d{4}$

With best regards

Anonymous  Mar 04, 2013 
PDF Page 8
top

Regular expression:

^(\(\d{3}\)|^\d{3}[.-]?)?\d{3}[.-]?\d{4}$

doesn't work neither with TextMate nor with regexpal.

When modified to:

^((\(\d{3}\)|\d{3})[.-]?)?\d{3}[.-]?\d{4}$

works fine.

Anonymous  Sep 01, 2012