wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regex Question from SCJP (Sierra & Bates) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regex Question from SCJP (Sierra & Bates)" Watch "Regex Question from SCJP (Sierra & Bates)" New topic
Author

Regex Question from SCJP (Sierra & Bates)

Khalid Chowdhury
Greenhorn

Joined: Jun 03, 2008
Posts: 2
Given:-



And the command line:


I'm confused as to why the output is 01234456

I'd be really grateful is someone could explain this.
Konrad Till
Greenhorn

Joined: Nov 20, 2012
Posts: 7
There is "234" in the output, because "34" match has been found at index 2.
Rest are indexes of zero-length matches, because * means zero or more.
See also exam watch on page 500 in the K&B book.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18765
    
  40

http://www.coderanch.com/how-to/java/SCJP-FAQ#kb-regexp


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regex Question from SCJP (Sierra & Bates)