This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Groups Usage (Pattern & Matcher ) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Groups Usage (Pattern & Matcher )" Watch "Groups Usage (Pattern & Matcher )" New topic
Author

Groups Usage (Pattern & Matcher )

Krishna Mir
Greenhorn

Joined: Jan 09, 2006
Posts: 12
When regular expressions are used as patterns to match the input strings, it results in groups of strings that have matched the pattern. These groups can be accessed using a back reference \n where n is the index of the group captured. I didn't understand the following table.


Whole content Regular expression Result

abab ([a-z][a-z])\1 Found the text "abab" starting at
index 0 and ending at index 4.

abcd ([a-z][a-z])\1 No match found

abcd ([a-z][a-z]) Found the text "ab" starting at
index 0 and ending at index 2.
and the text "cd" starting at
index 2 and ending at index 4

Can anybody please help me to undetstand above?

Thanks
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Groups Usage (Pattern & Matcher )
 
It's not a secret anymore!