regex pattern in java using Rege code example
Example 1: regular expression java
^(.+)@(.+)$ "^(.+)@(.+)$\""
^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$
^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?!-)(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$
Example 2: java regex
import java.util.regex.*;
public class RegexExample1{
public static void main(String args[]){
Pattern p = Pattern.compile(".s");
Matcher m = p.matcher("as");
boolean b = m.matches();
boolean b2=Pattern.compile(".s").matcher("as").matches();
boolean b3 = Pattern.matches(".s", "as");
System.out.println(b+" "+b2+" "+b3);
}}