wood burning stoves*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regex" Watch "Regex" New topic


joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117

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

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
Similar Threads
Total number of object string creates?
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
Dynamic Method Call
Doubt in EL
a simple question