aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Zero length matches?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Zero length matches??" Watch "Zero length matches??" New topic
Author

Zero length matches??

Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Hello all,
The following code splits the string into 4 strings out of them 3 of are zero length...
I thought i was strong in determining zero length matches..


Can someone suggest me any reference or tutorials regular expressions particularly zero length macthes....
Shahrukh Naqui
Greenhorn

Joined: May 01, 2010
Posts: 14

Hi,

The best brief lesson/tutorial that I found was Sun's own Java regex tutorial.

Zero length matches are well explained in the Quantifiers section of the tutorial.
Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Thank you Sharukh for reply,
I already read that tutorial and i think understood the concept well...
but i need more deep disussion about zero length matches particular...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Does this help ?



A zero length string is still a match. It is the empty string that resides between two "aaa" strings.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Thank you Deepak ...
I understood that problem ..
I want to read more about zero length matches...
can you suggest me some references??
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Hareendra Reddy wrote:Thank you Deepak ...
I understood that problem ..
I want to read more about zero length matches...
can you suggest me some references??


You can dive into the Pattern and Matcher implementations and knock yourself out. Those are the best references
Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Thank you Deepak..
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

There are books available on regular expressions like "Mastering Regular Expressions" or "Java Regular Expressions" which you can go through if you want in-depth knowledge of regular expressions...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Shahrukh Naqui
Greenhorn

Joined: May 01, 2010
Posts: 14

There is also this Regular expressions website, if you haven't found it already. Its quite detailed.
 
 
subject: Zero length matches??