This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I presume you're referring to regular expressions. There is a difference: there are non-greedy quantifiers such as "??", "*?" and "+?", in contrast to greedy quantifiers like "?", "*" and "+". According to K&B, only greedy quantifiers are examined in SCJP 5.
Thanks for the URLs. Also iam getting bit scared as my exam is within 2 weeks away and i have read some basics ..Anyways i will give it a go.I dont have much time.I have allocated only 1 month for the exam.So fingers crossed.I hope i pass the exam;-);-)
Joined: Mar 22, 2004
Hello, I have again got this confusion.. How can i ever find out when is a quantifier becomes greedy ex: 1)proj([^,])* --> is a quantifier
So according to it,given the following text "proj3.txt,proj1sched.pdf,proj1,proj2,proj1.java"
why doesnt it match the whole text..It acts as a reluctant and matches
proj1sched.pdf proj1 proj1.java
Just because the regex doesn't match the "whole text" doesn't make the qualifier "reluctant". In this case, the "greedy" qualifier still has to obey what is being qualified ([^,]) and can't match anything with commas.
If you change the qualifier in the pattern to reluctant:
You will see that each find() will try to match as little as possible. And the matches are...
proj1 proj1 proj1
Hope this helps, Henry
Joined: Sep 14, 1999
Did you write the text at that link yourself Wise?