Java examples for java.util.regex:Match Word
has Repeat by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { private static Pattern PATTERN_REPEAT = Pattern.compile(".*(.).*\\1.*"); public static boolean hasRepeat(String repeat) { if (repeat == null) return false; else/*from w w w .j a v a 2s. c o m*/ return PATTERN_REPEAT.matcher(repeat).matches(); } }