Java Pattern toString() MethodThe toString() Method of Pattern class returns the String representation of compiled pattern. This method of Pattern class overrides the "toString" in class Object. Syntax:ParameterNA ReturnsThis method returns the string representation of this pattern. Example 1Test it NowOutput: [a-zA-Z]+\.? Pattern to be matched [a-zA-Z]+\.? Pattern to be matched Example 2Test it NowOutput: (.*)(\d+)?# 2 groups java.util.regex.Matcher[pattern=(.*)(\d+)?# 2 groups region=0,52 lastmatch=]
Next TopicJava Pattern
|