Errata
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
| Version |
Location |
Description |
Submitted By |
| Printed |
Page 142
first code example |
The author's correction is wrong. There should be a forward slash in front of the "B" in the last BOLD. I don't know if this will show up right, but here goes:
s#<BOLD>(.*)</BOLD>#$1#g;
Now for the second problem. The text says,
-------
....I'm talking about the cartoon with Fred and <BOLD>Wilma</BOLD>!
And here's a substitution to remove the tags. But what's wrong with it?
#<BOLD>(.*)</BOLD>#$1#g; #this is the corrected substitution
The problem is that the star is greedy.
-------
The star is in fact greedy, but there is absolutely nothing wrong with the substitution. It will work exactly the way a beginner will think it will on that string.
A suggestion: get rid of the first string:
"I'm talking about the cartoon with Fred and <BOLD>Wilma</BOLD>!"
and replace it by the second string:
'I thought you said Fred and <BOLD>Velma</BOLD>, not <BOLD>Wilma</BOLD>';
Then the problem with the first substitution will be abundantly clear to anyone who tries the code. There should only be one string on the page and two code snippets for the substitution.
|
7stud |
| Printed |
Page 142
first code example |
Now, I botched the quote from the book in my previous errata. The leading 's' for the substitution didn't make it into my copy/paste.
|
7stud |