Java.util.regex.Matcher in java?
java.util.regex.Matcher in java?Explain with example.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Mar 28, 2014, 3:19 PM EDT
Having used the Pattern class to define a regular expression, the Matcher class is then used to match the pattern against some text.
The Matcher class doesn't have a constructor. Instead you create a Matcher object by calling the static Pattern.matcher() method.
The Matcher class has various methods including matches, find, group, start and end.
The following example illustrates the use of these methods:
Abhijeet SinghRank #415 · 6K reputationPosted Mar 28, 2014, 7:04 PM EDT