dimanche 4 novembre 2018

Java, getting portion of pattern partially matched by input

As title says, i'd like to get the portion of the pattern that is being matched partially by the input; example:

Pattern: aabb Input string: "aa"

At this point, i'll use hitEnd() method of Matcher class to find out if the pattern is being matched partially, like shown in this answer, but i'd also like to find out that specifically "aa" of "aabb" is matched. Is there any way to do this in java?

Aucun commentaire:

Enregistrer un commentaire