One, the code is as follows
Package Com.wujianbo.five;import Java.util.regex.matcher;import Java.util.regex.pattern;public class Demo01 {public static void Main (string[] args) {//TODO auto-generated method stubstring phone= "13541433525"; String phoneex= "^1[387]\\d{9}"; Pattern pattern= Pattern.compile (Phoneex);//compile regular expression Matcher matcherphone= pattern.matcher (phone); System.out.println (Matcherphone.matches ());}}
Package Com.wujianbo.five;import Java.util.regex.matcher;import Java.util.regex.pattern;public class Demo01 {public static void Main (string[] args) {//TODO auto-generated method stub//string phone= "13541433525";//string phoneex= "^1[387 ]\\d{9} ";//pattern pattern= Pattern.compile (Phoneex);//compile regular expression//matcher matcherphone= pattern.matcher (phone);// System.out.println (Matcherphone.matches ()); String telephone= "0512-85121234"; String telephoneex= "^0\\d{2,3}-[856]\\d{6,7}"; System.out.println (Pattern.compile (Telephoneex). Matcher (telephone). matches ());}}
Package Com.wujianbo.five;import Java.util.regex.pattern;public class Demo03 {public static void main (string[] args) {// TODO auto-generated method stub//string email= "[email protected]"; String email= "[email protected]"; String emailex= "[a-za-z0-9{1,}@ ((a-za-z0-9-*) {1,}\\.) {1,3} [a-za-z\\-] {1,} "; String emailex= "[A-za-z0-9]{1,}@[a-za-z0-9]{1,}. [A-za-z0-9] {1,}. [A-za-z0-9] {1,}$ "; System.out.println (Pattern.compile (Emailex). Matcher (email). matches ());}}
Package Com.wujianbo.five;import Java.util.regex.matcher;import Java.util.regex.pattern;public class Demo02 {public static void Main (string[] args) {//TODO auto-generated method stubstring source= "<input name= ' verify ' value= ' 3334DFAF Addfa ' type= ' hidden '/> '; String regex= "(value= ') (. +) (' type)"; String tmp= ""; Pattern p= Pattern.compile (regEx); Matcher m= p.matcher (source);//system.out.println (M.find ()); if (M.find ()) {tmp= m.group (2); SYSTEM.OUT.PRINTLN (TMP);}}}
Package com.wujianbo.five;
Import Java.util.regex.Matcher;
Import Java.util.regex.Pattern;
Public class Demo02 {
public &NBSP; static &NBSP; void main (string[] args ) {
// TODO auto-generated Method Stub
String Source = "<input name= ' verify ' value= ' 3334dfafaddfa ' type= ' hidden '/> ' ;
String regEx = "(value= ') (. +) (' type)" ;
String tmp = "" ;
P Attern p = Pattern. compile ( regex );
Matcher m = P . Matcher (source);
System.out.println (M.find ());
if (m. Find ()) {
tmp = m . Group (2);
System. out . println (tmp);
}
}
}
Automation _ Continuous Integration ___java___ Regular expressions