“正则表达式”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) |
Jihongchang(讨论 | 贡献) |
||
(未显示同一用户的11个中间版本) | |||
第6行: | 第6行: | ||
https://www.runoob.com/regexp/regexp-metachar.html | https://www.runoob.com/regexp/regexp-metachar.html | ||
+ | |||
+ | |||
+ | 正则表达式在线测试工具 | ||
+ | |||
+ | https://www.cjavapy.com/tools/regex/ | ||
+ | |||
+ | https://regex101.com/ | ||
第66行: | 第73行: | ||
[[String类提供的正则表达式应用]] | [[String类提供的正则表达式应用]] | ||
+ | |||
+ | [[正则表达式 练习:验证邮箱地址|练习:验证邮箱地址]] | ||
+ | |||
+ | [[正则表达式 练习:验证是否整数或小数|练习:验证是否整数或小数]] | ||
+ | |||
+ | [[正则表达式 练习:解析URL|练习:解析URL]] | ||
+ | |||
+ | [[Java正则表达式大全]] | ||
+ | |||
+ | [[正则表达式 递归匹配]] | ||
+ | |||
+ | |||
+ | |||
+ | https://www.bilibili.com/video/BV1Eq4y1E79W/?p=27 内容总结、梳理 | ||
PatternSyntaxException 是一个非强制异常类,它表示一个正则表达式模式中的语法错误。 | PatternSyntaxException 是一个非强制异常类,它表示一个正则表达式模式中的语法错误。 | ||
第73行: | 第94行: | ||
[] 括起来的是字符集合; | [] 括起来的是字符集合; | ||
− | () | + | () 主要表示<u>正则表达式结合优先级</u>、<u>匹配后分组捕获</u>、和<u>反向引用的应用</u>。 |
其它参考:https://www.regular-expressions.info/ | 其它参考:https://www.regular-expressions.info/ | ||
* | * |
2024年2月11日 (日) 03:24的最新版本
https://www.bilibili.com/video/BV1Eq4y1E79W
元字符大全:
https://www.runoob.com/regexp/regexp-metachar.html
正则表达式在线测试工具
https://www.cjavapy.com/tools/regex/
可视化工具:
https://c.runoob.com/front-end/7625
简单使用的示例:
import java.util.regex.Pattern;
public class Hello {
public static void main(String[] args) {
String content = "I am hsp from hspedu.com.";
String pattern = ".*hspedu.*";
boolean isMatch = Pattern.matches(pattern, content);
System.out.println("是否整体匹配成功:" + isMatch);
}
}
语法
https://www.bilibili.com/video/BV1Eq4y1E79W/?p=27 内容总结、梳理
PatternSyntaxException 是一个非强制异常类,它表示一个正则表达式模式中的语法错误。
[] 和 () 的区别:
[] 括起来的是字符集合;
() 主要表示正则表达式结合优先级、匹配后分组捕获、和反向引用的应用。
其它参考:https://www.regular-expressions.info/