Java examples for Language Basics:String
Finding Text Matches with regular expressions and the String matches() helper method to determine how many matches exist.
public class Main { public static void main(String[] args) throws Exception { String str = "Here"; boolean result = str.matches("Here"); System.out.println(result);//from w w w. j a v a 2s. c om result = str.matches("Here is a long String..."); System.out.println(result); } }