I searched for Java regex issues and found out about the Pattern and Matcher classes so that you get a group of text around reg-ex matching criteria.
However, my requirement is different. I want to extract the actual text represented by a regular expression.
Example:
Input text: ABC 22. XYZ
Regular expression: (.*) [0-9]* (.*)
Using the Pattern and Matcher classes (or any other method in Java), how can I get the text "22."? This is the text that represents the regular expression.
amrut source
share