Online Java Compiler By
JavaTpoint.com
import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatcherMatchesExample1 { public static void main(String[] args) { Pattern p = Pattern.compile(".*http://.*", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher("This is URL:Http://localhost"); //Matching the particular pattern against regular expression boolean matches = m.matches(); System.out.println("matches = " + matches); } }
Output