📄 useregularexprssion.java
字号:
import java.io.*;
public class UseRegularExprssion {
public static void main(String[] args) throws IOException{
BufferedReader reader =new BufferedReader(new InputStreamReader (System.in));
System.out.println("abcdefgabcabc ".replaceAll(".bc","###"));
String phoneEL="[0-9]{4}-[0-9]{6}";
String urlEL="<a.+href*=*['\"]?.*?['\"]?.*?>";
String emailEL="^[_a-z0-9-]+(.[_a-z0-9-]+)*"+"@[a-z0-9-]+([.][a-z0-9-]+)*$";
System.out.print("write the phone number:");
String input = reader.readLine();
if(input.matches(phoneEL))
System.out.println("geshizhengque");
else
System.out.println("geshiwrong");
System.out.print("shuru href biaoqian:");
input = reader.readLine();
if(input.matches(urlEL))
System.out.println("geshizhengque");
else
System.out.println("geshiwrong");
System.out.print("write the email:");
input = reader.readLine();
if(input.matches(emailEL))
System.out.println("geshizhengque");
else
System.out.println("geshiwrong");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -