permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes group method function in Regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "group method function in Regex" Watch "group method function in Regex" New topic
Author

group method function in Regex

Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72


The output is coming 01234456
I think answer should be 0123445, i dont know where i am confusing, Can somebody please let me know where i am miising the concept of group();
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

After last letter can occur empty string.
Have a look, please:
http://java.sun.com/docs/books/tutorial/essential/regex/quant.html


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18754
    
  40

http://faq.javaranch.com/java/ScjpFaq#kb-regexp


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
Thanks to all...I got it
 
 
subject: group method function in Regex