Online Java Compiler By
JavaTpoint.com
import java.util.regex.Matcher; import java.util.regex.Pattern; public class PatternCompileExample4{ public static void main(String[] args) { int c1=0; //pattern/expression to be match Pattern p1=Pattern.compile("\u00de",Pattern.MULTILINE |Pattern.UNICODE_CASE |Pattern.CASE_INSENSITIVE |Pattern.COMMENTS); //Regular expression Matcher m1=p1.matcher("\u00fE \n \u00fe "); while(m1.find())// finding pattern in regular expression { c1 =c1+1; System.out.println(" Start : "+m1.start()+", End : "+m1.end()+" Pattern group : "+m1.group()); } System.out.println(" number of Matches: "+c1); } }
Output