Sams Teach Yourself Regular Expressions in 10 Minutes

Sams Teach Yourself Regular Expressions in 10 Minutes

by Ben Forta


View All Available Formats & Editions
Usually ships within 6 days

Product Details

ISBN-13: 9780672325663
Publisher: Sams
Publication date: 03/09/2004
Series: Sams Teach Yourself Series
Pages: 160
Sales rank: 294,070
Product dimensions: 5.50(w) x 8.20(h) x 0.40(d)

About the Author

Ben Forta is Macromedia Inc.'s Senior Technical Evangelist and has more than two decades of experience in the computer industry in product development, support, training, and marketing. Ben is the author of the popular Sams Teach Yourself SQL in 10 Minutes (in this same series), ColdFusion Web Application Construction Kit, its sequel Advanced ColdFusion Application Development, as well as books on JavaServer Pages, Windows development, mobile computing, and other topics. More than one-quarter million Ben Forta books have been printed in more than a dozen languages worldwide. He writes regular columns on Internet and application development topics and spends a considerable amount of time lecturing and speaking on application development worldwide. Ben welcomes your email at and invites you to visit his Web site at

Table of Contents


1. Introducing Regular Expressions.

Understanding the Need. How Regular Expressions Are Used. So What Exactly Is a Regular Expression? Using Regular Expressions. Before You Get Started. Summary.

2. Matching—Single Characters.

Matching Literal Text. Matching Any Characters. Matching Special Characters. Summary.

3. Matching Sets of Characters.

Matching One of Several Characters. Using Character Set Ranges. "Anything But" Matching. Summary.

4. Using Metacharacters.

Escaping Revisited. Matching Whitespace Characters. Matching Specific Character Types. Using POSIX Character Classes. Summary.

5. Repeating Matches.

How Many Matches? Using Intervals. Preventing Over Matching. Summary.

6. Position Matching.

Using Boundaries. Using Word Boundaries. Defining String Boundaries. Summary.

7. Using Subexpressions.

Understanding Subexpressions. Grouping with Subexpressions. Nesting Subexpressions. Summary.

8. Using Backreferences.

Understanding Backreferences. Matching with Backreferences. Performing Replace Operations. Summary.

9. Looking Ahead and Behind.

Introducing Lookaround. Looking Ahead. Looking Behind. Combining Lookahead and Lookbehind. Negating Lookaround. Summary.

10. Embedding Conditions.

Why Embed Conditions? Using Conditions. Summary.

Appendix A: Regular Expressions in Popular Applications and Languages.

grep. JavaScript. Macromedia ColdFusion. Macromedia Dreamweaver. Macromedia HomeSite (and ColdFusion Studio). Microsoft ASP. Microsoft ASP.NET. Microsoft C#. Microsoft .NET. Microsoft Visual Studio .NET. MySQL. Perl. PHP. Sun Java.

Appendix B: Regular Expression Solutions to Common Problems.

North American Phone Numbers. U.S. ZIP Codes. Canadian Postal Codes. United Kingdom Postcodes. U.S. Social Security Numbers. IP Addresses. URLs. Complete URLs. Email Addresses. HTML Comments. JavaScript Comments. Credit Card Numbers. Summary.

Appendix C: The Regular Expression Tester.

Understanding the Regular Expression Tester Application. Obtaining a Copy of the Application.

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Sams Teach Yourself Regular Expressions in 10 Minutes 4.3 out of 5 based on 0 ratings. 4 reviews.
Guest More than 1 year ago
I just bought the book today and I have already finished reading it. The information in this book is outstanding, especially if you are new to regular expressions. I recommend this book to anyone that wants to learn an efficient way to preform string validation.
Guest More than 1 year ago
I got this book 2 days ago. It is great. I'm only to chapter 3 but it is making everything clear to me finally! Normally I don't have time to read up on things like regex because of workload, but this info has already saved me time at work! Also, the appendix with the real world regex's is a great time saver. I recommend it to everyone.
Anonymous More than 1 year ago
I started reading this and immediately got hit with the fact that the "results" for each query were incorrect (shows the same data as the "text" field) on my Nook Tablet. So I downloaded the Nook PC application and viewed the book, and you can see where the text is shaded grey with the "results" field, showing the proper output if a query were run. That said, I wouldn't buy this for the Nook, unless there is some trick to making it work that I don't know about. I'm only on page 50, but I like the flow of the book so far.
Anonymous More than 1 year ago