public class PatternCompile { public static void main(String[] args) { String text = "This is the text to be searched " + "for occurrences of the http:// pattern."; String patternString = ".*http://.*"; Pattern pattern = Pattern.compile(patternString); System.out.println("pattern : "+pattern); System.out.println(" === ===============---============== === "); Pattern p = Pattern.compile(".s"); Matcher m = p.matcher("as"); boolean b1 = m.matches(); boolean b2 = Pattern.compile(".s").matcher("ass").matches(); System.out.println("pattern : "+b1+", pattern : "+b2); } }
Wednesday, 8 February 2017
Regex : PatternCompile
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment