Win a Free Copy of Regex Cookbook 2nd Edition
Update: This contest is now finished. See the list of winners.
I'm excited to announce the release of Regular Expressions Cookbook 2nd Edition, which I wrote together with regex superguru Jan Goyvaerts. It has actually been available as an ebook for a couple weeks on oreilly.com, but as of now, it is also in stock on amazon.com.
To promote this release, O'Reilly Media is giving away free copies to 15 people who comment on this post on or before September 7th! To get a free copy, you must read the details at the end of this post. But first, some FAQs about the second edition:
Wait…this is a cookbook?
The book tackles hundreds of real-world regular expression tasks in a problem, solution, discussion format. There's also a detailed regular expression tutorial included, in the same format. Check out Jeff Atwood's and Ben Nadel's reviews of the first edition, which have more details about this.
Update: Rob Friesel Jr. posted an awesome, detailed review of the second edition.
The first edition was a bestseller, and is now available in eight languages. It briefly held Amazon's #1 spot for computer books upon its release in mid 2009, and the ebook version was O'Reilly's top seller of 2010.
What has changed with this new edition?
The second edition adds more content, and updates existing chapters. There are innumerable improvements, including the most noticeable addition of a new chapter written by Jan, titled Source Code and Log Files, and various new recipes interspersed with four of the other chapters.
There are 101 new pages in the second edition, and that's after shortening and removing some content from the first edition. There were 125 recipes in the first edition, upped to 146 in the second. Note that many of the book's recipes provide solutions and in-depth discussions for more than one problem. Tons of changes, ranging from minor copyedits and errata corrections to major revisions and the addition of significant new content, were made throughout the existing content. Everything was brought up to date with the latest standards, tools, and programming language versions. In particular, updates to Java and Perl since the first edition brought very significant regular expression changes. Plus, we've covered some advanced regular expression features that already existed the last time around, but didn't make it into the first edition.
The first edition was already groundbreaking for the depth of its explanations and its equal coverage of all regexes in eight programming languages (C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET). The second edition significantly improves upon this by providing even more details about the many peculiarities and differences of the APIs, syntax, and behavior of these regex flavors and programming languages. The second edition also adds coverage of XRegExp when it provides a better solution than native JavaScript. IMO, the second edition is easily the most comprehensive source of information about the use of modern regexes across multiple programming languages—far more detailed than anything else in print or online.
What will interest long-term fans the most?
Even though there are lots of important changes throughout the book, the new recipes and the updated coverage for the latest programming languages are probably the main reasons for owners of the first edition to upgrade. The fully-new recipes cover creating a regex-based parser, validating password complexity, adding thousands separators to numbers, matching various kinds of numbers, decoding XML entities, and everything in the new Source Code and Log Files chapter. The coverage of XRegExp is also completely new in the second edition.
What will cause readers to trip over themselves in their haste to buy a copy?
If you read though the book, you'll learn about a lot of things—much more than just regular expressions. You'll almost certainly learn something new about Unicode, phone numbers, and XML, as just a few examples. You'll learn that the eighth floor of the Saks Fifth Avenue store in New York City has its own ZIP code, which also happens to be the only ZIP code that includes letters. You'll learn that the Chicago Manual of Style and Merriam-Webster's Biographical Dictionary disagree on the correct alphabetical listing of the name Charles de Gaulle (my girlfriend and I are in opposing camps). Jan and I put a ton of research into the book, and we pay attention to details. I think that shines through.
Oh yeah, and along the way, you'll also become a Master Chef of regular expressions, able to slice and dice text with the best of them. But not everyone will want to actually read through the book. Some readers will prefer to take advantage of the cookbook format and read only the parts that solve their immediate problems. That's fine, too.
Many developers complain that they're continually relearning regular expressions, going back to the reference documents every time they need to write a new regex. The problem/solution approach of Regular Expressions Cookbook means you learn by doing, and we think that helps the details stick with you more securely than with the other books and websites out there.
Many regex novices turn to Google to get prewritten regexes that solve their problems. Unfortunately, if you're not already fluent in regex, you won't realize that 90% of the regexes out there have some kind of problem, be it returning false positives or negatives, performing inefficiently (or maybe even crashing your server when fed malicious data), being more complicated than necessary, not being portable, or what have you. When you use the regexes in Regular Expressions Cookbook, not only do you get detailed coverage of all the related issues (which helps you customize the solution, if necessary), you also get the peace of mind that you're using proven solutions by real subject-matter experts.
So how do I enter to win a free copy?
Simply comment on this blog post on or before 11:59 PM EDT on September 7th, and you'll be in the running. I wish I could leave the contest open a bit longer, but I'll be moving to California to work for a little Internet startup. You'll need to use your actual first and last name and email address with your comment. Names are published, but email addresses are not. Each person commenting has only one chance to win, regardless of how many comments they post. If you don't know what to write in your comment, just mention whether you'd prefer a print or ebook copy.
Shortly after this contest ends, I'll randomly choose 15 winners and contact them by email. If you prefer a printed copy, I'll be asking for your address and, if you're outside of the U.S., your phone number. O'Reilly will pay for shipping to anywhere in the world. Good luck!
Coauthor Jan Goyvaerts has written up his own summary of the changes in What's New in The Second Edition of Regular Expressions Cookbook.
Follow me on Twitter @slevithan or on GitHub at slevithan.
Comment by Pablo Lara H on 2 September 2012:
Count me in! (e-book copy)
Comment by João Britto on 2 September 2012:
I’m so excited about this 2nd Ed. XRegExp was a really great adittion. Kudos!
Comment by Robert Bouma on 2 September 2012:
Nice one! If I’m one of the lucky few, I’d prefer a print copy.
Comment by Mathias Bynens on 2 September 2012:
I wouldn’t mind an e-book copy 😉
Comment by Moe Tsao on 2 September 2012:
It would be great to get one copy!
Comment by Igor Kononuchenko on 2 September 2012:
I would like a print version 🙂
Comment by Ben Blank on 2 September 2012:
Congrats on the move! Maybe we’ll bump into each other at a meetup.
I look forward to getting my hands on an ebook copy, even if I end up having to purchase it myself. 😉
Comment by jack simmonds on 2 September 2012:
This sounds like a phenomenal time saver for those not already expert at creating regex. I know I go looking for ready made solutions when I have to get something done. I enjoy figuring them out, but it’s nice to have proven code when you’re adding features to a site.
I’d be happy to get either the print or e-book versions. The easiest would be the e-book.
Comment by TJ Rothwell on 2 September 2012:
Congrats on book. I’m still a tree killer for the books I read
Comment by Mark Sost on 2 September 2012:
I’d love a copy of this new edition!
Comment by Alexander Inführ on 2 September 2012:
Oh this book sounds aweseome.
So far i learned some basic regexp and this book would be perfect addition.
Looking forward to hear from you 😀
Alex
Comment by Dominique Papin on 2 September 2012:
e-book edition, free the trees 😉
Comment by Jasir Ansari on 2 September 2012:
A print edition would be nice 🙂
Comment by Ashutosh Singh on 2 September 2012:
I have read the 1st Edition and I can’t wait to have my hand around 2nd
Comment by Rodiney Elias on 2 September 2012:
Amazing! Hope to be one of the winners.
I prefer a printed copy please.
Thanks mate!
Comment by Berker Peksag on 2 September 2012:
Hey, I would like a print version. Thanks!
Comment by davide molin on 2 September 2012:
Count me in (ebook)!! Regex are surely an interesting topic to tackle and a cookbook is a brilliant idea!Definitely appreciated
Comment by Martijn Coppoolse on 2 September 2012:
I would be most interested in an e-book version. (For free would be a bonus :).
Comment by Samar on 2 September 2012:
Let me try my luck for a ebook copy ;).
Comment by Carl Bennett on 2 September 2012:
A print copy would be great 🙂
Comment by Belikov Sergey on 2 September 2012:
Count me in!
Comment by Rick Gordon on 2 September 2012:
I’ve got the first edition, but would love the updates of the second.I’ve got the ebook for the first, so maybe the print book for the second would be good. (I like having both, actually.)
Comment by Johan Rhedin on 2 September 2012:
I’d love this as an ebook.
Comment by Asen Bozhilov on 2 September 2012:
Congrats!
So, If 23 is my lucky number, send me a print copy 😉
Comment by Matijs Brinkhuis on 2 September 2012:
Would just love an ebook copy!
(will be interesting to see people’s preferences with regard to print or ebook)
Comment by Chintan Thakkar on 2 September 2012:
I’d love this as an ebook.
Comment by Daniel Knittl-Frank on 2 September 2012:
Congrats on the 2nd edition, which I’m now craving for.
If I won copy, I’d like a printed book 🙂
Keep up the good work!
Comment by Brendan Owen on 2 September 2012:
I would love an ebook. Regex are the next thing on my learning tech stuff list.
Comment by Harrald on 2 September 2012:
I would love a copy!
Comment by Andy Davies on 2 September 2012:
Good going… If 90%+ of regexes on the internet have problems, how do we know yours don’t? 😉
Would prefer ebook if I win
Comment by Oleksandr on 2 September 2012:
I would be happy to get printed one! Count me!
Comment by Tom Hache on 2 September 2012:
I’d love to read the print copy of your book!
Comment by Geert De Deckere on 2 September 2012:
Looking forward to a print copy. Thank you!
Comment by lucien baron on 2 September 2012:
It’s a great idea. A print copy will be awesome. Thank you.
Comment by Christian Wirkus on 2 September 2012:
var me = “Wanna have an ebook”;
/Wanna have an ebook/.test(me);
Comment by Pieter Beulque on 2 September 2012:
I would love a print copy!
Comment by Rod on 2 September 2012:
Woo! How could I *not* enter a chance to win this book from the regex *masters*. Great job on keepin this book up to date Steven.
Comment by Alexander H on 2 September 2012:
Good time of the day!
I’d like a print book. An ideal variant could be both print and electronic ones – I prefer to read print books, but files are really better for reference and search. Anyway, I will be very glad to get any version of it. And in addition I’m going to buy one in translation to my language when it will be printed.
Thanks in advance!
Comment by Dag Monsen on 2 September 2012:
Great 😀 Ebook, pretty please 🙂
Comment by Andrew Herrington on 2 September 2012:
Hi, I’d love a copy of your book, it sounds fantastic! Anything that can clear up the murky waters of regex would be great. Printed copy please.
Many thanks,
Andrew
Comment by Francisc Romano on 2 September 2012:
Uuu, RegEx! I’d love the print copy please.
Comment by Victor on 2 September 2012:
Hi!
Print copy could be nice! Thanks for the good work.
Victor
Comment by Kennie Cruz on 2 September 2012:
The source code and log file seems like a very nice addition. Finally something that will have a great impact in my daily routine.
Comment by Robert George on 2 September 2012:
Print copy.
Comment by Valentin Ceaprazaru on 2 September 2012:
I would like a printed copy of this book.
Comment by Jared on 2 September 2012:
Sounds amazing! I’d love a printed copy.
Comment by stephen collings on 2 September 2012:
Ebook, yo!
Comment by Ray Daly on 2 September 2012:
I have the ebook of the previous Verizon and store it my Dropbox. When coding RegEx I’ll often write it myself and then search the Cookbook to see if I missed anything. Email is a perfect example. The authors had done the research and I had better validation for my form.
I look forward to getting the new ebook edition even if I don’t win it here.
Comment by Jeff Sims on 2 September 2012:
I would love a printed copy!!
Comment by Mindi Rogers Green on 2 September 2012:
I would genuinely appreciate a print copy of this new edition.
Comment by Ola Lundén on 2 September 2012:
I’m thrilled about this new regexp book. It would be nice with a e-book copy.
Comment by Paul-Andre Duchesne on 2 September 2012:
… Sorry very big fingers make me post twice…
So I was saying a very good news for the time saving and performant analysis this book will provide, such as have brought me the first edition 🙂
I look forward to get the new ebook edition even if I’m not selected to win it 😉
Comment by Brian Diesel on 2 September 2012:
I would like a copy.
Comment by Alexey Levzhinsky on 2 September 2012:
Great! E-book copy.
Comment by Ryan Quigley on 2 September 2012:
Print please! Looks like a great book!
Comment by Rod Marcal on 2 September 2012:
Sounds great! Regex are really useful.
Print edition, please!
Thanks!
Comment by Wesley Calaca on 2 September 2012:
Good job!!
I would like to get one of those printed copy!
Comment by David Brown on 2 September 2012:
I would love an ebook copy but a print version would be a nice addition to my bookshelf at work
Comment by Roberto Poo on 2 September 2012:
I would love to have a print copy!
Comment by Mike on 2 September 2012:
Would love an ebook copy of the book.
Comment by Scott Thorne on 2 September 2012:
I “live in” MS Office apps most of every workday (sound familiar to any of you?), it’s the business thing. Anyway, when trying to work smarter, I am often looking in RegEx reference trying to improve search/replace and VBA scripts. I doubt I’m the only person like this, doing most regex like tasks when banging on MS Office Word (aargh). That should get some content allocation as well.
I prefer ebooks. I use a Kindle, so mobi is good, but I find myself referring to the PDFs on the PC more often.
Comment by Pete Lamonica on 2 September 2012:
Cool beans! I’d love an ebook!
Comment by Steven Levithan on 2 September 2012:
@Scott Thorne, O’Reilly provides DRM-free ebooks in PDF, Mobi, and ePub formats, so you can get all three. 🙂
Comment by Gail on 2 September 2012:
Would like print
Comment by Kazue on 2 September 2012:
Ebook please
Comment by Max Podriezov on 2 September 2012:
Wow, would love to have print version
Comment by Dominik Porada on 2 September 2012:
I’d prefer a printed copy of the book.
Comment by Mika on 2 September 2012:
I’d love the ebook!
Comment by Wim Mostmans on 2 September 2012:
I would love to have a print version.
Comment by Leif Halvard Silli on 2 September 2012:
Great. This is, me think, the only regex book that covers JavaScript. (Now send me da book – any format is fine!)
Comment by Remy Bach on 2 September 2012:
RegEx has literally changed the way I code and I only know the beginnings of what it can do! I’d love to get either version and get a better knowledge on the subject!
Comment by Kyle Davis on 2 September 2012:
Wow. I could use a copy!
Comment by Ilan on 2 September 2012:
Thanks! I want your book!
Comment by Kyle on 2 September 2012:
Count me in for an e-book – I’ve started to scratch the surface of the potential of RegEx and I’d love to learn more.
Comment by Michael Haufe on 2 September 2012:
It will be interesting to see how the 2nd edition compares. I would prefer a print version
Comment by Henk Scholten on 2 September 2012:
Right in time, the previous print version is wearing out here by using it so much. 😉 Although the little RegEx Buddy Owl is present on my taskbar, ready to help me out again, the book is always within reach too.
Comment by Garner Halloran on 2 September 2012:
Loved the last version. Count me in for e-book please!
Comment by Ivaylo Ivanov on 2 September 2012:
I’m looking forward to the 2nd edition of this very useful book… Count me in for the ebook or the hard copy
Comment by Nick Hegarty on 2 September 2012:
Hook me up with a physical copy!
Comment by zeljko on 2 September 2012:
Thanks for a free ebook!
Comment by Bret Little on 2 September 2012:
Wish I were more of a regex ninja, maybe this book can help out!
Comment by Rob Simpson on 2 September 2012:
I look forward to this chance and hope that I can grab one of these print books.
Comment by E Michael Brandt on 2 September 2012:
Wow, an ebook would be great. Thanks.
Comment by Sachin on 2 September 2012:
a ebook for regex – sign me in. Awesome work guys.
Comment by Tony Dunsworth on 2 September 2012:
Oh my, why wouldn’t I want a good book on this subject! Please count me in.
Comment by Sebastian Rodriguez on 2 September 2012:
Excellent initiative! I would love to read the new edition 🙂
Comment by Jack Waddington on 2 September 2012:
How I would love a free copy of “Regex Cookbook 2nd Edition”. I am one of those individuals that prefers to curl up in a quiet corner, study until I have the gist of the chapter in my head, before heading to the computer to put it into practice.
Comment by Sean on 2 September 2012:
Gotta send something to Saks Fifth Avenue now, just because. Print book.
Comment by Daniel Vandersluis on 2 September 2012:
I’d like a print copy please! 🙂
Comment by David Wilhelm on 2 September 2012:
I would enjoy an e-book version. Thanks!
Comment by Jurij Rejec on 2 September 2012:
I’d really like dead-tree copy 😉
Comment by Davis S on 2 September 2012:
I wanted the Free copy too poor to buy it.
EBook Copy
Comment by Anthony Canino on 2 September 2012:
I would love an ebook copy!
Comment by Jacob Christiansen on 3 September 2012:
Me too, me too!!!
Comment by Ben Cooper on 3 September 2012:
I needs this
Comment by Roberto Santana on 3 September 2012:
Great news! I’ll wait to know if I’m one of the winners before to buy it as eBook. Thanks for the job!
Comment by Zheneva on 3 September 2012:
It would be great to get one copy!
Comment by Rafa? Kukawski on 3 September 2012:
I’d prefer a printed copy of the book. Thank you.
Comment by Ahmed Muzammil on 3 September 2012:
Print Copy… 🙂
Comment by Sandeep ShivaramaReddy on 3 September 2012:
Wow!!! I am form INDIA 🙂 This is really great to hear Steven. O’REILLY has been a nice guide for the learners especially.Looking forward the new book releases. Hopefully i would get a chance to win printed version this copy 🙂