Patterns review: Utility makes quick work of regular expressions<article>
<section class="page">
<p>You know the maxim, “Give a man to fish and he eats for a day; teach a man to fish and he eats for a lifetime”? A similar adage applies to anyone who spends a lot of time working with text on their Mac: Learn how to use
regular expressions—sequences of characters and variables that you can use to perform powerful searches—and you’ll benefit greatly, for a very long time.</p><p>I’ve saved hours or days—maybe even
weeks—of time over the past decade or so by using pattern-matching search-and-replace actions on text. Regular expressions (also called
regex or
grep) form the common language that most programs use for these actions. Specifically, I’ve been
using grep in BBEdit, crafting complex patterns and then pressing the Find button and hoping that my pattern is right. But it isn’t always—learning regex takes practice and involves lots of trial and error.</p><p class="jumpTag"><a href="/article/2109200/patterns-review-utility-makes-quick-work-of-regular-expressions.html#jump">To read this article in full or to leave a comment, please click here[/url]</p></section></article>
Source:
Patterns review: Utility makes quick work of regular expressions