If you have a Safari Books Online subscription, you can start reading Regular Expressions Cookbook on Safari Books Online right now. If you don’t, you can still click that link and then click the red free trial button in the upper right corner of the web page.
When Regular Expressions Cookbook was published as a printed book in June, it was immediately available on Safari in “print fidelity view”. This view loads one page from the printed book at a time as an image. I don’t find that view very useful for technical books. It requires too many clicks and downloads too slow to read comfortably. That’s why I didn’t blog about the Safari edition before.
Safari Books Online now shows Regular Expression Cookbook in HTML format. HTML format loads much faster even while displaying one complete recipe per web page, even if it spans a dozen pages in the printed book.
When Regular Expressions Cookbook was published, I was told by O’Reilly that a Kindle edition would be unlikely, due to the special formatting we use in the book for regular expressions. It seems that those technical difficulties have been overcome, as Amazon now offers a Kindle edition of Regular Expressions Cookbook. I presume the formatting of the Kindle edition won’t be identical to the printed book. I don’t have a Kindle, iPod, or iPhone, so I can’t check.
When I write this, Amazon lists the Kindle edition for $17.59. That’s the lowest price for the book I’ve seen to date. You need a Kindle, iPhone, or iPod Touch to be able to read the Kindle edition. Amazon sells the printed book for $29.70, while O’Reilly sells a DRM-free PDF for $31.99 and the printed book for $44.99.
Some users have reported that TPerlRegEx for Delphi 2009 causes their applications to crash when the component is freed. I finally got around to testing this in detail. It turns out the bug only occurs when using the DLL, and that the crash actually occurs in the DLL when pcre_free is called.
I’ve now released a new version of TPerlRegEx that comes with a new DLL that exports a custom pcre_dispose function which the component now calls instead of pcre_free. To upgrade to the new version, simply recompile your application with the new PerlRegEx.pas and pcre.pas, and replace pcre3.dll with pcrelib.dll. The new DLL is compiled from the PCRE 7.9 sources.
While I was at it, I also updated the OBJ files to PCRE 7.9. To use the OBJ files instead of the DLL, edit pcre.pas to comment out the PCRE_LINKDLL define and uncomment the PCRE_STATICLINK define. Due to bugs in the Delphi compiler, this only works if you do not install TPerlRegEx into a design time package. That means you’ll have to instantiate the component at runtime instead of dropping it onto a form.
Download TPerlRegEx. Source is included under the MPL 1.1 license.
Update: I hadn’t properly updated all the files in the .zip file on on August 12th. This has now been fixed.