Java Matcher lookingAt() methodThe lookingAt() method of Matcher class is used to match the input sequence against the beginning of the text. This method is similar to matches() except the difference that matches() match the regular expression against the whole text. Syntax:ParameterNo parameter Returnstrue if, and only if, a prefix of the input sequence matches this matcher's pattern Example 1Test it NowOutput: lookingAt = true Example 2Test it NowOutput: lookingAt = true matches = false Example 3Test it NowOutput: lookingAt = true java.util.regex.Matcher[pattern=java programm region=0,50 lastmatch=java programm]
Next TopicJava Matcher class
|