The Bastards Book of Regular Expressions
The Bastards Book of Regular Expressions
Free!
Minimum price
$5.00
Suggested price
The Bastards Book of Regular Expressions

This book is 60% complete

Last updated on 2013-04-02

About the Book

This is a spinoff of a chapter from the Bastards Book of Ruby. Regular expressions are an essential and useful skill even outside of programming. They can serve not only as a handy tool for anyone whose work involves writing or data, but also act as a gateway into more interesting and complex kinds of programming. While you're waiting for me to finish this experiment in self-publishing, you can get a good start by reading the massive chapter on regular expressions in the BBoR

About the Author

Dan Nguyen
Dan Nguyen

Dan Nguyen is the author of the still-incomplete Bastards Book of Ruby and Photography. He is currently Head of Data at Skift and was formerly a news application developer at the investigative newsroom, ProPublica.

Table of Contents

  • Regular Expressions are for Everyone
  • FAQ
  • Release notes & changelog
  • Getting Started
  • Finding a proper text editor
  • Why a dedicated text editor?
  • Windows text editors
  • Mac Text Editors
  • Sublime Text
  • Online regex testing sites
  • A better Find-and-Replace
  • How to find and replace
  • The limitations of Find-and-Replace
  • There’s more than find-and-replace
  • Your first regex
  • Hello, word boundaries
  • Word boundaries
  • Escape with backslash
  • Regex Fundamentals
  • Removing emptiness
  • The newline character
  • Viewing invisible characters
  • Match one-or-more with the plus sign
  • The plus operator
  • Backslash-s
  • Match zero-or-more with the star sign
  • The star sign
  • Specific and limited repetition
  • Curly braces
  • Curly braces, maximum and no-limit matching
  • Cleaning messily-spaced data
  • Anchors: A way to trim emptiness
  • The caret as starting anchor
  • The dollar sign as the ending anchor
  • Escaping special characters
  • Matching any letter, any number
  • The numeric character class
  • Word characters
  • Bracketed character classes
  • Matching ranges of characters with brackets and hyphens
  • All the characters with dot
  • Negative character sets
  • Negative character sets
  • Capture, Reuse
  • Parentheses for precedence
  • Parentheses for captured groups
  • Correcting dates with capturing groups
  • Using parentheses without capturing
  • Optionality and alternation
  • Alternation with the pipe character
  • Optionality with the question mark
  • Laziness and greediness
  • Greediness
  • Laziness
  • Lookarounds
  • Positive lookahead
  • Negative lookahead
  • Positive lookbehind
  • Negative lookbehind
  • The importance of zero-width (TODO)
  • Regexes in Real Life
  • Why learn Excel?
  • The limits of Excel (todo)
  • Delimitation
  • Mixed commas and other delimiters
  • Dealing with text charts (todo)
  • Completely unstructured text (todo)
  • Moving in and out and into Excel
  • From Data to HTML (TODO)
  • Simple HTML tricks
  • Example Domain
  • Tabular data to HTML tables
  • Mocking full web pages from data
  • Visualizations
  • The Exercises
  • Data Cleaning with the Stars
  • Normalized alphabetical titles
  • Make your own delimiters
  • Finding needles in haystacks (TODO)
  • Shakespeare’s longest word
  • Changing phone format (TODO)
  • Telephone game
  • Ordering names and dates (TODO)
  • Year, months, days
  • Names
  • Preparing for a spreadsheet
  • Dating, Associated Press Style (TODO)
  • Scenario
  • The AP Date format
  • Real-world considerations
  • The limits of regex
  • Sorting a police blotter
  • Sloppy copy-and-paste
  • Start loose and simple
  • Conclusion
  • Converting XML to tab-delimited data
  • The payments XML
  • The pattern
  • Add more delimitation
  • Cleaning up Microsoft Word HTML (TODO)
  • Switching visualizations (TODO)
  • A visualization in Excel
  • From Excel to Google Static Chart
  • From Google Static Charts to Google Interactive Charts
  • Cleaning up OCR Text (TODO)
  • Scenario
  • Cheat Sheet
  • Moving forward
  • Additional references and resources

Authors have earned$8,179,639writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub