13.07.2015 Views

Download - The Bastards Book of Regular Expressions

Download - The Bastards Book of Regular Expressions

Download - The Bastards Book of Regular Expressions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Moving forwardThank you for taking the time to read this book and congrats if you managed to finish it withoutcursing me or regexes too much. If the syntax and details still seem adrift in your memory, that’sfine. Print out a cheat sheet. Look at it whenever the chance to use regexes come up and soon they’llbe as familiar as you’ve ever done on a computer.<strong>The</strong> trick is to find opportunities to practice. <strong>The</strong> first thing is to use a regex-enabled text editor as<strong>of</strong>ten as you can, either by opening text files or pasting text/spreadsheets into them.<strong>The</strong>n, find the little things to fix. Maybe there’s a place in the document where there’s 3 spaces wherethere should be one. Instead <strong>of</strong> clicking on that space and hitting Backspace twice, just pop-up theFind-and-Replace dialogue and look for \s+Or, if you’ve written a lengthy article and you just know you’ve misused “its” and “it’s” somewhere.Paste your article into a text editor and do a quick search for it'?sI promised at the beginning that you’d find regexes useful even if you don’t program. However, Ipromise that with just a little programming, regexes become even more powerful. Using a regex t<strong>of</strong>ind proper nouns or large numbers is pretty useful in a 100-page document. Imagine how useful itbecomes when you write a script to search 1,000 100-page documents, all at once, with that samepattern.But the beauty <strong>of</strong> regexes is that they’re useful no matter what your technical level. So don’t programif you don’t feel like you can invest the time, but hopefully what you’ve learned so far will havesparked ideas and uses you had never thought <strong>of</strong>.Additional references and resourcesThis book covers about 90% <strong>of</strong> the regexes I use in a day to day basis, but it by no means coversthe many powerful (and crazy) uses that are out there. More importantly, I cover virtually none <strong>of</strong>the theory or inner-workings <strong>of</strong> why the regex engine behaves as it does, which is essential as yourpattern-making becomes more and more complicated.Luckily, there are a huge amount <strong>of</strong> resources for you to go as deep as you need to, and many <strong>of</strong>these resources are free and online. Here’s a short list <strong>of</strong> ones I’ve found useful.• http://www.regular-expressions.info/³⁴ – I think I owe my regex ability almost entirely to thissite. It <strong>of</strong>fers both easy-to-read overviews <strong>of</strong> the concepts and indepth walkthroughs whenyou need to know the details. It’s no surprise that regular-expressions.info is almost alwaysthe first Google result for any regex-related query.³⁴<strong>Regular</strong>-expressions.info166

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!