This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regex" Watch "Regex" New topic
Author

Regex

joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117

Why am I not getting any output in the above case?
Dave McIntyre
Greenhorn

Joined: Oct 22, 2006
Posts: 8
The quantifier *+ is a possessive quantifier. From the API:
Possessive quantifiers, which greedily match as much as they can and do not back off, even when doing so would allow the overall match to succeed.

So the .*+ matches as much as it can (which is the whole of the string) and there is none of the string left to match the "hello" part of the pattern.
joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117
Thanks Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regex