Items related to Regular Expressions Cookbook

Regular Expressions Cookbook - Softcover

  • 4.10 out of 5 stars
    195 ratings by Goodreads
 
9780596520687: Regular Expressions Cookbook

Synopsis

This O'Reilly Cookbook provides more than a hundred recipes to help programmers use regular expressions to manipulate text and crunch data. Every programmer needs a grasp of regular expressions, but their power doesn't come without problems--even seasoned users often have trouble tackling performance issues. With recipes for popular programming languages such as C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET, this book offers step-by-step solutions to scores of common tasks involving regular expressions. This cookbook will help you: Understand the basics of regular expressions through a concise tutorial Use regular expressions effectively in several programming and scripting languages Learn how to validate and format input Manage words, lines, special characters, and numerical values Find solutions for using regular expressions in URLs, paths, markup, and data exchange Learn the nuances of mor

"synopsis" may belong to another edition of this title.

Review

Whether you're a novice or an experienced user, Regular Expressions Cookbook will help deepen your understanding of the tool. You'll learn powerful new tricks, avoid language-specific gotchas, and save valuable time with this huge library of proven solutions to difficult, real-world problems.

Searching and Replacing with Regular Expressions
Search-and-replace is a common job for regular expressions. A search-and-replace function takes a subject string, a regular expression, and a replacement string as input. The output is the subject string with all matches of the regular expression replaced with the replacement text. Although the replacement text is not a regular expression at all, you can use certain special syntax to build dynamic replacement texts. All flavors let you reinsert the text matched by the regular expression or a capturing group into the replacement. Recipes 2.20 and 2.21 explain this. Some flavors also support inserting matched context into the replacement text, as Recipe 2.22 shows. In Chapter 3, Recipe 3.16 teaches you how to generate a different replacement text for each match in code.

Many Flavors of Replacement Text
Different ideas by different regular expression software developers have led to a wide range of regular expression flavors, each with different syntax and feature sets. The story for the replacement text is no different. In fact, there are even more replacement text flavors than regular expression flavors. Building a regular expression engine is difficult. Most programmers prefer to reuse an existing one, and bolting a search-and-replace function onto an existing regular expression engine is quite easy. The result is that there are many replacement text flavors for regular expression libraries that do not have built-in search-and-replace features.
Fortunately, all the regular expression flavors in this book have corresponding replacement text flavors, except PCRE. This gap in PCRE complicates life for programmers who use flavors based on it. The open source PCRE library does not include any functions to make replacements. Thus, all applications and programming languages that are based on PCRE need to provide their own search-and-replace function. Most programmers try to copy existing syntax, but never do so in exactly the same way.
This book covers the following replacement text flavors. Refer to “Many Flavors of Regular Expressions” on page 2 for more details on the regular expression flavors that correspond with the replacement text flavors:
Perl
Perl has built-in support for regular expression substitution via the s/regex/ replace/ operator. The Perl replacement text flavor corresponds with the Perl regular expression flavor. This book covers Perl 5.6 to Perl 5.10. The latter version adds support for named backreferences in the replacement text, as it adds named capture to the regular expression syntax.
PHP
In this book, the PHP replacement text flavor refers to the preg_replace function in PHP. This function uses the PCRE regular expression flavor and the PHP replacement text flavor.
Other programming languages that use PCRE do not use the same replacement text flavor as PHP. Depending on where the designers of your programming language got their inspiration, the replacement text syntax may be similar to PHP or any of the other replacement text flavors in this book. PHP also has an ereg_replace function. This function uses a different regular expression flavor (POSIX ERE), and a different replacement text flavor, too. PHP’s ereg functions are not discussed in this book.
.NET
The System.Text.RegularExpressions package provides various searchand- replace functions. The .NET replacement text flavor corresponds with the .NET regular expression flavor. All versions of .NET use the same replacement text flavor. The new regular expression features in .NET 2.0 do not affect the replacement text syntax.
Java
The java.util.regex package has built-in search-and-replace functions. This book covers Java 4, 5, and 6. All use the same replacement text syntax.
JavaScript
In this book, we use the term JavaScript to indicate both the replacement text flavor and the regular expression flavor defined in Edition 3 of the ECMA-262 standard.
Python
Python’s re module provides a sub function to search-and-replace. The Python replacement text flavor corresponds with the Python regular expression flavor. This book covers Python 2.4 and 2.5. Python’s regex support has been stable for many years.
Ruby
Ruby’s regular expression support is part of the Ruby language itself, including the search-and-replace function. This book covers Ruby 1.8 and 1.9. A default compilation of Ruby 1.8 uses the regular expression flavor provided directly by the Ruby source code, whereas a default compilation of Ruby 1.9 uses the Oniguruma regular expression library. Ruby 1.8 can be compiled to use Oniguruma, and Ruby 1.9 can be compiled to use the older Ruby regex flavor. In this book, we denote the native Ruby flavor as Ruby 1.8, and the Oniguruma flavor as Ruby 1.9. The replacement text syntax for Ruby 1.8 and 1.9 is the same, except that Ruby 1.9 adds support for named backreferences in the replacement text. Named capture is a new feature in Ruby 1.9 regular expressions.

Book Description

Detailed Solutions in Eight Programming Languages

"About this title" may belong to another edition of this title.

  • PublisherO'Reilly Media
  • Publication date2009
  • ISBN 10 0596520689
  • ISBN 13 9780596520687
  • BindingPaperback
  • LanguageEnglish
  • Edition number1
  • Number of pages510
  • Rating
    • 4.10 out of 5 stars
      195 ratings by Goodreads

Buy Used

Condition: Good
Pages can have notes/highlighting...
View this item

FREE shipping within U.S.A.

Destination, rates & speeds

Search results for Regular Expressions Cookbook

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: ThriftBooks-Atlanta, AUSTELL, GA, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Good. No Jacket. Pages can have notes/highlighting. Spine may show signs of wear. ~ ThriftBooks: Read More, Spend Less 1.55. Seller Inventory # G0596520689I3N00

Contact seller

Buy Used

US$ 6.76
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: ThriftBooks-Reno, Reno, NV, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Fair. No Jacket. Readable copy. Pages may have considerable notes/highlighting. ~ ThriftBooks: Read More, Spend Less 1.55. Seller Inventory # G0596520689I5N00

Contact seller

Buy Used

US$ 6.76
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: ThriftBooks-Dallas, Dallas, TX, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Fair. No Jacket. Readable copy. Pages may have considerable notes/highlighting. ~ ThriftBooks: Read More, Spend Less 1.55. Seller Inventory # G0596520689I5N00

Contact seller

Buy Used

US$ 6.76
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: ThriftBooks-Atlanta, AUSTELL, GA, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Fair. No Jacket. Readable copy. Pages may have considerable notes/highlighting. ~ ThriftBooks: Read More, Spend Less 1.55. Seller Inventory # G0596520689I5N00

Contact seller

Buy Used

US$ 6.76
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: ThriftBooks-Atlanta, AUSTELL, GA, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Very Good. No Jacket. May have limited writing in cover pages. Pages are unmarked. ~ ThriftBooks: Read More, Spend Less 1.55. Seller Inventory # G0596520689I4N00

Contact seller

Buy Used

US$ 6.76
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Softcover

Seller: SecondSale, Montgomery, IL, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Condition: Good. Good condition ex-library book with usual library markings and stickers. Seller Inventory # 00085029527

Contact seller

Buy Used

US$ 6.77
Convert currency
Shipping: FREE
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used paperback First Edition

Seller: The Maryland Book Bank, Baltimore, MD, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

paperback. Condition: Good. 1st Edition. Corners are slightly bent. Used - Good. Seller Inventory # 13-C-5-0137

Contact seller

Buy Used

US$ 2.80
Convert currency
Shipping: US$ 4.20
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Softcover

Seller: Goodwill Books, Hillsboro, OR, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Condition: Good. Signs of wear and consistent use. Seller Inventory # 3IIT5H005DE8_ns

Contact seller

Buy Used

US$ 3.55
Convert currency
Shipping: US$ 3.99
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Levithan, Steven,Goyvaerts, Jan
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Paperback

Seller: HPB-Red, Dallas, TX, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Paperback. Condition: Good. Connecting readers with great books since 1972! Used textbooks may not include companion materials such as access codes, etc. May have some wear or writing/highlighting. We ship orders daily and Customer Service is our top priority! Seller Inventory # S_343937563

Contact seller

Buy Used

US$ 4.00
Convert currency
Shipping: US$ 3.75
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

Stock Image

Goyvaerts, Jan; Levithan, Steven
Published by O'Reilly Media, 2009
ISBN 10: 0596520689 ISBN 13: 9780596520687
Used Softcover

Seller: Seattle Goodwill, Seattle, WA, U.S.A.

Seller rating 5 out of 5 stars 5-star rating, Learn more about seller ratings

Condition: Good. May have some shelf-wear due to normal use. Your purchase funds free job training and education in the greater Seattle area. Thank you for supporting Goodwills nonprofit mission! Seller Inventory # 0KVOFY003YCG_ns

Contact seller

Buy Used

US$ 4.52
Convert currency
Shipping: US$ 3.99
Within U.S.A.
Destination, rates & speeds

Quantity: 1 available

Add to basket

There are 7 more copies of this book

View all search results for this book