5 of 5 people found the following review helpful
Taming developers for the REGEX adventure,
This review is from: Java Regular Expressions: Taming the java.util.regex Engine (Paperback)
Java, with simplicity being the prime motto started off by striking off pointers, generics, multiple inheritance, regex, high-end reflection etc., from the core language. But as time progressed, folks at sun started bringing those features back into the language out of growing necessity. Java 1.2 added a proper Collections API, Java 1.3 added Dynamic Proxy model, Java 1.4 added Regex, Java 1.5 added generics and so on...
Regular Expressions (REGEX) are one of those weirdly named concepts that establishes a back-off-i-am-complex sort of impression at first sight. Admittedly, it has a strong mathematical foundation and a tidy sum of theory backing its existence. But, that doesnt mean that learning and using them in programming languages have to be difficult, in fact it is not even close to difficult as long as we are well guided by trained personnel.
In this book, the author attempts to train us on regular expressions as it applies to java.
Chapter 1 answers questions like "What is a regular expression" and "How to create regular expressions with that weird syntax".
In my opinion, this chapter is a tad quicker than one would like. So, those new to regex might find it a bit intimidating.
Chapter 2 introduces you to the java's regex object model. Specifically the Pattern and Matcher objects are addressed along with the additions to the String class.
At first, i thought that this chapter is nothing but a copy-paste of javadocs. Later, when i referred javadocs for further information i realized that the author truly took the pain to decode it before presenting it here. This chapter is a good reference for the java regex object model.
Chapter 3 explains the advanced concepts like groups, subgroups, back-references, greedy qualifiers, possessive qualifiers, reluctant qualifiers, positive look-aheads, negative look-aheads, positive look-behinds and negative look-behinds. Finally, the author enlightens us with some tips on how to create efficient regular expressions.
In my opinion, this section is too thin. It covers too many concepts in too little pages. I would have expected a more exhaustive coverage here.
Chapter 4 tries to demonstrate practical usage of regular expressions in the context of an object oriented language like java.
This chapter is too ambitious about being practical; and gets too involved with file I/O and NIO than is necessary. Reading this chapter is a waste of time because it neither explains NIO nor REGEX well.
Chapter 5 takes a few of real-life use-cases like Email validation, Phone Number validation etc. and attempts to solve it.
Again, i was hoping that this section will contain interesting information, but was very dissapointed. Many examples were a mere copy-paste from earlier chapters.
Bottomline, if you are looking for a head start in java regex; this book helps. But, if you are looking for an indepth coverage of concepts, the art of writing efficient expressions and are expecting to become a regex expert, then this book alone wont suffice. You might have to try reading this book(for java api) along with "Mastering Regular Expressions" (for regex concepts) to achieve that goal.