Java examples for Regular Expressions:Word
returns true if the string contains exactly "word" via regex
public class Main { public static void main(String args[]) { String s = "main"; s = s.toLowerCase();/*from ww w . j a v a 2 s . c o m*/ if (s.matches(".*main.*")) // returns true if the string contains exactly "main" System.out.println("found"); } }