Regex

Latest

  • DevJuice: Regular Expressions Cookbook enters 2nd edition

    by 
    Erica Sadun
    Erica Sadun
    10.03.2012

    Regular expressions are a staple of development. A grammar for matching forms to text, regular expressions are used in Apple development for use with predicates, in validating text entry and more. O'Reilly just released a new edition of Jan Goyvaerts' & Steven Levithan's "Regular Expressions Cookbook" (US$50 list price, $30 street price.) Revised and expanded, the book offers a wealth of common regex use-cases, from numbers to URLs, email addresses to post codes. It's primarily a reference book, so don't expect to sit down with this book on a warm and cozy night. It's the book that you put on your shelf and pull out whenever you need to look up a few specific patterns. I grabbed the first edition of this book at an O'Reilly Foo camp retreat a few years back. The second edition offers the same well-indexed quick help as the first one. If you already own the first edition, the second may not exactly be a must-buy except for completionists. The table of contents and book material are largely the same. If you haven't picked one up yet, however, then this is the regex reference you've been looking for. Here are a few other regex online resources you may find handy: The Regular Expression Library site has indexed thousands of regular expressions from contributors around the world. Go to Regex Pal to test your regex expressions via an interactive JavaScript tool. Use the txt2re generator to build code that extracts elements from source strings that you provide. It supports output in C as well as several other language destinations.

  • TUAW Tip: Regular Expressions for Beginners

    by 
    Robert Palmer
    Robert Palmer
    09.08.2008

    Sometimes I think Regular Expressions are like the tax code: if someone professes to know everything about them, they're probably not telling the truth. In reality, Regular Expressions (or RegEx) is a syntax to help you construct very precise search terms to find and replace bits of text in a variety of applications. In applications like Coda, BBEdit, and TextMate, you can search for a "string" -- meaning just any old collection of letters next to each other -- using a Regular Expression. For example, I could search for the string "laugh" and it would show up in laughter, slaughter, and Laughlin. While I can't show you everything about Regular Expressions, I can at least start you off. Keep reading for more about how you can integrate Regular Expressions into your workflow.