| Author |
SCJP 5.0 objective 3
|
Ravith Botejue
Greenhorn
Joined: May 25, 2005
Posts: 6
|
|
can somone explain to me about the regular expressions and how greedy, reluctant, possesive quantifiers work, also the new locale class and the printf() method. I have read the MZ's SCJP Tiger Notes but I am still not clear. -------------------- RB
|
RB
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16680
|
|
Originally posted by Ravith Botejue: can somone explain to me about the regular expressions and how greedy, reluctant, possesive quantifiers work, also the new locale class and the printf() method. I have read the MZ's SCJP Tiger Notes but I am still not clear. RB
To be blunt, regular expressions are *very* complex. And in many ways, can be regarded as a complete language on its own. Unfortunately, the Java Documentations assumes that you already know regular expressions, and just summarized the topic. The best documentation that I have seen on Regular Expressions are actually part of the perl documentation. Search the perl.com website for the regular expression documentation. And while you are at it, learning perl may not be a bad idea either... Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Philip Heller
author
Ranch Hand
Joined: Oct 24, 2000
Posts: 119
|
|
Fortunately, the objectives only mention greedy quantifiers, which are the default behavior. The quantifiers you need to know about are: * ... matches zero or more occurrences of the preceding pattern. + ... matches 1 or more occurrences of the preceding pattern. ? ... matches zero or 1 occurrence. A greedy quantifier will match the longest possible sequence of characters. A reluctant or possessive quantifier might not match the longest possible sequence, depending on some really intricate principles that fortunately aren't required knowledge for the SCJP exam. Makes me wonder what future enhancements we might see? How about an obsessive-compulsive quantifier, which consumes all characters even if it's not appropriate. Or a manic-depressive quantifier, which cycles between greedy and reluctant behavior.
|
Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
|
 |
 |
|
|
subject: SCJP 5.0 objective 3
|
|
|