Regular expressions are an extremely powerful tool for manipulating text and data. They are now standard features in a wide range of languages and popular tools, including Perl, Python, Ruby, Java, VB.NET and C# (and any language using the .NET Framework), PHP, and MySQL.
If you don't use regular expressions yet, you will discover in this book a whole new world of mastery over your data. If you already use them, you'll appreciate this book's unprecedented detail and breadth of coverage. If you think you know all you need to know about regularexpressions, this book is a stunning eye-opener.
As this book shows, a command of regular expressions is an invaluable skill. Regular expressions allow you to code complex and subtle text processing that you never imagined could be automated. Regular expressions can save you time and aggravation. They can be used to craft elegant solutions to a wide range of problems. Once you've mastered regular expressions, they'll become an invaluable part of your toolkit. You will wonder how you ever got by without them.
Yet despite their wide availability, flexibility, and unparalleled power, regular expressions are frequently underutilized. Yet what is power in the hands of an expert can be fraught with peril for the unwary. Mastering Regular Expressions will help you navigate the minefield to becoming an expert and help you optimize your use of regular expressions.
Mastering Regular Expressions, Third Edition, now includes a full chapter devoted to PHP and its powerful and expressive suite of regular expression functions, in addition to enhanced PHP coverage in the central "core" chapters. Furthermore, this edition has been updated throughout to reflect advances in other languages, including expanded in-depth coverage of Sun's java.util.regex package, which has emerged as the standard Java regex implementation.Topics include:
A comparison of features among different versions of many languages and tools How the regular expression engine works Optimization (major savings available here!) Matching just what you want, but not what you don't want Sections and chapters on individual languages Written in the lucid, entertaining tone that makes a complex, dry topic become crystal-clear to programmers, and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions, Third Edition offers a wealth information that you can put to immediateuse.
Reviews of this new edition and the second edition:
"There isn't a better (or more useful) book available on regular expressions."
--Zak Greant, Managing Director, eZ Systems
"A real tour-de-force of a book which not only covers the mechanics of regexes in extraordinary detail but also talks about efficiency and the use of regexes in Perl, Java, and .NET...If you use regular expressions as part of your professional work (even if you already have a good book on whatever language you're programming in) I would strongly recommend this book to you."
--Dr. Chris Brown, Linux Format
"The author does an outstanding job leading the reader from regexnovice to master. The book is extremely easy to read and chock full ofuseful and relevant examples...Regular expressions are valuable toolsthat every developer should have in their toolbox. Mastering RegularExpressions is the definitive guide to the subject, and an outstandingresource that belongs on every programmer's bookshelf. Ten out of TenHorseshoes."
Mwah, mwah! Thank you, Jeff Friedl, for finally - FINALLY - demystifying this most crucial of meta-programming skills: regular expressions. I had tried online tutorials, videos, even a retro bash game, this and that. Nothing ever helped. This did. FINALLY. FINALLY!
So I didn't "read" the whole book, but whatever, the second half is reference material for languages I never use nor plan to use (Perl, PHP, etc.). Honestly, the first 2-3 chapters were sufficient; once he got into the guts of different regex languages, I felt like I was teleported back to 1983 Bay Area, sitting next to Steve Wozniak as he pecked at his clackety-clack keyboard and wrote the original BSD man pages. Awwww myyyannn, I just did `man grep` to double-check my facts and DAMMIT the last update to the grep man page was 2010!!!! Way to kill my joke, Unix.
Henyyyway. Highly recommended, though YMMV - people learn in diff ways. I had been daunted by regexes since the 2009 Stata days, and I just *WISH* I had had this then.
Mastering Regular Expressions by Jeffrey E.F. Friedl это замечательная книга/учебник. Всем программистам иметь/читать обязательно. UNIX/Linux программистам я рекомендую прочитать эту книгу раз десять (т.е. выучить наизусть).
Без навыков написания regex очень сложно (практически невозможно) использовать sed, awk, shell, perl, python, etc. А без этого работать на UNIX системах не получится (исключение из этого правило это Java-Java программеры, которым в принципе все равно на какой системе работать, лишь бы было окошко Eclipse)
If you ever need to dive deeply into regular expressions, then this is the book to read. It doesn't just cover syntax, but dived deeply into state machines, optimizations and the way the engine's are generally implemented.
This book, however, doesn't tell you how to use each different dialect of Regex out there and some of the things the book explains might not be true for your regex engine of choice. I've used it a lot in conjunction with the Regular Expression Pocket Reference: Regular Expressions for Perl, Ruby, PHP, Python, C, Java and .NET and that kind of fills that void (though the second edition contains a few errors in the syntax examples for .NET code, which is my engine of choice normally.
Before O'Reilly started trying to be hip and cool and coining terms like "Web 2.0", they used to write books that didn't suck. This is one of them.
Think you know regular expressions? This book isn't a simple introduction that fades out somewhere near character classes. It's called "Mastering Regular Expressions", and that indeed is it's intent.
Giving this book a perfect rating because this enables you to think in terms of building a correct and efficient regular expression and does that with a great correctness and efficiency. Had a doubt in a section of book, emailed author and he replied promptly! It discussed in great deal the mechanism of the engine and which helps to think in terms of regular expression.
You will only have one hand free while reading Mastering Regular Expressions because Jeffrey Friedl will take you by your other hand and lead you through everything there is to know about regular expressions.
You will see your mistakes corrected as you make them, you will ask questions and find their answers at the end of the page, and when Jeffrey explains concepts in Ruby, right before you open your mouth to tell him that you only code in Java, he will point to the next page where you will find the same code written in it.
The first couple of chapters are an introduction to the subject, with a few examples that increase in complexity as you go on. By the end of the third chapter (only a third of the book), you would already know every possible RegEx mechanic.
However, throughout all that, you will come across notes on many examples, explaining that they will be revisited in later chapters to correct a few mistakes or be made more efficient, with page numbers referencing where to ease the book's navigation.
But before beginning with the advanced techniques, Jeffrey takes a break from the subject of usage to explain the inner workings of RegEx engines. Without showing any code, you are shown how engines go about parsing expressions and exactly why some patterns perform worse than others in certain situations.
By the time you begin with the advanced techniques, you will find yourself equipped enough to understand the reason behind each of them. And I would like to believe that at that point, like myself, you will bow to the brilliance of Jeffrey E.F. Friedl and the way he explains concepts.
The last few chapters each discuss regular expressions for certain languages. Like most readers, I skipped the ones that didn't concern me (Ruby and .NET). I must say that even there, I was still surprised to find extremely specific tips, signifying the time spent using and researching these libraries for the sole purpose of writing these sections.
Mastering Regular Expressions is a book made with great brilliance and dedication, it provides a fantastic reading experience with its examples and references, and I doubt you would find any better book on the subject.
Good, practical guide for understanding how regular expressions work without going into the deep stuff about automata theory. I was hoping for more practical coverage of different syntaxes and more examples rewritten in each, especially Emacs. Still, quite good about regular expressions in general. But if you want to learn a particular flavor, you will need something more focused on that language or tool.
There is a more recent edition published in 2002 with 150 additional pages that I haven't looked at.
Brain draining ...considering kind of gray cells I have between the ears. But, not all lost ..most was very known to me from other sources and over long time practice ...little bit here and there ...so it was not a unfamiliar story(if you think in that way of purely technical book) .
Anyway, learn loads of stuff , useful ...but I am not yet sure how much I can remember and use ...probably lean on to this time and again.
Highly recommended, if you want to deal with complex stuff and want pinpoint accuracy of the applicable things by knowing intricacies of inner working of RegEx(yes, in the tech world we called this subject by this short name!, convenient) .
To be upfront, I did not read the book cover to cover - I stuck to the chapters that were relevant to me and what I needed in an immediate sense. That being said, the content in those chapters was invaluable.
A good introduction and reference book on regular expressions. I've read this book as some who knows and has used regular expressions but has found its use to be difficult. This book is a much more in depth learning tool than the 5 min explanations you will find online.
If you're a programmer of any kind you should know regular expressions. And if you want to learn regular expressions, this is the bible. That's all there is to it.
The book cleared a lot of fog in my understanding of regular expressions. I knew they're based on finite automata theory (from this excellent book, which I highly recommend). I thought DFAs and NFAs are equivalent in power and different regular expression engines just implement their own translations of regexes to those NFA or DFA forms. It turned out, modern regular expressions much, much more powerful than NFAs. This book explains why. As a side effect, it helps to understand how to craft correct and efficient regular expression. Even for the POSIX NFA engine.
I wasn't sure about the interaction of regular expressions with language around them. This includes escaping rules, regex engine types and so on. There's a lot of examples in different languages so you can really feel the difference between regex flavors.
I didn't read the whole book, the second half is about guts of languages I never use nor plan to use (Perl, PHP, .Net).
-1 star for silly examples. Who's gonna parse HTML or even URLs using regular expressions? It's a minefield.
I'm currently reading this book, not done yet, but I'll rate it 5 stars anyway for its usefulness. Regex, which provides a formal way to express text search patterns, is one of the things I always promised to learn properly, since the need for it - finding and replacing text - pops up so often in software development. In my current assignment I've had to use it on a VERY regular basis, and this prompted me to sit down with this volume and go through it front to back.
The first part of the book deals with regex in a very general way; later on it gets into implementation-specific issues, the mechanics of how it actually works, and performance considerations. I've only read through the first parts, and already it has been very useful. I'm very much looking forward to the rest.
At this point in the book, the author has provided examples using egrep (a software tool that searches text using regex) and Perl, which has very comprehensive support for it. Both of these are available online at no additional cost, and if you are running OS X or Linux you probably already have Perl installed.
I have actually found it even more useful to keep one of the online regex testing pages (https://regex101.com is a good one) open while reading, which makes it easy to try things out as I'm reading. I should mention that I purchased the Kindle edition, so that I could stay in the same environment for reading and trying out code examples. Very highly recommended.
Update: I'm going to say I'm done with this, even though I may not have read every page. It's a good reference, and has proven useful several times. Still very highly recommended.
I read the first edition in 1999 and found it incredibly useful since it helped me learn to think in regex, building efficient and accurate expressions instead of hacking away until it seemed to work. It also helped me build maintainable patterns that others would be able to read and grok.
I'm reading the 3rd edition now as a refresher, and to revisit the way regex engines are constructed since I see these problems differently now.
For the 3rd edition I would have preferred a different language than Perl for the introduction. I know Perl very well, have written fun JAPH scripts, attended a Perl conference, and brought engineering discipline to the systems I wrote with it (long ago)... but it's not something I'd consider modern or intuitive. Learning about $/, <>, and interpolation of @ aren't really necessary for learning regular expressions. It is a good choice for some reasons though, especially the /x modifier, which improves readability.
Overall I give it a 4. It would be a 5 for the regex portions, though there's a bit too much filler narrative that I skim. The print quality for my copy isn't what I'd expect from O'Reilly, so I prefer reading the ebook version.
I am reading "Mastering Regular Expressions" by Jeffrey Friedl, and am really enjoying it. Not only is it a topic that I find very interesting, but Jeffrey does a great job of leading you (and challenging you) on a path of discovering the power of regex. The narrative is sometimes a bit too self-conscious (the author never lets you forget that it's HIM doing the talking), but that can be forgiven because the book is well written and interesting.
I don't read a lot of technical, "geeky" books, so I don't have a broad base for comparison. But this is definitely the best I've read. So far, my only quibble is that he says that regex should be pronounced with a hard G, as in regular, rather than a soft G, as in regina. I haven't met a programmer yet who pronounces it this way, some of whom have been using regex for many years. We pronounce it rej'eks. Personally, I find reg'eks awkward to pronounce.
I read the first edition many years ago and while I don't remember the contents in detail, I get the impression that this edition has a much smoother opening than its predecessor, and is thus an easier book to read for less experienced programmers. The first few chapters teach the core techniques, with could recaps and summaries, as well as a lot of useful examples.
The second half of the book is much more advanced and focuses more on the technical aspects of regex engines, ways of maximizing efficiency in regular expressions and chapters on the implementation of regular expressions in various programming languages, including Perl, Java, and PHP.
It is really a classic work and a must for anyone who wants to learn how to think about regular expressions instead of just viewing a list of metacharacters found in a language documentation file.
A really good book about regular expressions. It covers the basics and builds up to more advanced details. By the time I got to read this book, I was already familiar with regular expressions and pretty comfortable using them, but this book helped me a great deal with understanding how engines actually go about. I especially liked chapter 4. Skipped everything past Chapter 6 since they're tool-specific discussions and probably outdated. By the way, there are many dated things in this book but they aren't major (the way regular expressions work hasn't actually changed). I'd love if it delved deeper into the computer science aspect of them, relating it with our current usage of regexes, but the way Jeffrey handled the material regarding this was good enough.
This was my first book on Regular Expression, so I won't be saying that it is the best or most thorough (no real frame of reference), like some other reviewers do. However, I love the style, the layout, the amount of detail, ... everything about this book. I tend to read a few books on a subject I am researching, because I feel like certain things were not covered or were covered poorly. I will not be picking up another book on RegEx. I will certainly revisit this book from time to time.
I cannot emphasize enough how great this book is. I would highly recommend it to anyone interested in learning (and really understanding) Regular Expressions.
Книга помогает лучше понять как правильно составлять регулярные выражения, понимать какие данные поддаются анализу регулярными выражениями, а какие - нет. Она должна стать настольной книгой разработчиков, которые часто анализируют данные и хотят это делать качественно и быстро (автор обращает внимание не только на составление регулярных выражений, но и на их оптимизацию). Очень хорошая книга, рекомендую к прочтению, но будьте осторожны - после прочтения хочется все обработать регулярными выражениями! :)