regex - 使用正则表达式的 URL 验证给出错误
问题描述
class Testimmutablestring1{
public static void main(String[] args )
{
Pattern p = Pattern.compile("^(http://|https://)?(www.)([a-zA-Z0-9]+).[a- zA-Z0-9]*.[a-z]{3}.?([a-z]+)?$"));
Matcher m;
m=p.matcher(https://test.com:8080/wh-101);
}
}
错误:tablestring1.java:3:错误:';' 预期 A-Z0-9]+).[a-zA-Z0-9]*.[az]{3}.?([az]+)?$")); ^ tablestring1.java:5: 错误: ')' 预期 m=p.matcher( https://test.com:8080/wh-101 ); ^ 2 个错误
谁能解释一下
解决方案
推荐阅读
- python - 如何使用 Selenium 从动态网站中抓取数据
- redis - 没有 redis 的 Django 频道
- api - 如何为 Kubernetes 准入控制器编写响应
- java - 新关键字和实例关键字有什么区别?
- react-native - 使用带有 React 本机 init 的 yarn 工作区时缺少依赖项
- python - cv2.COLOR_BGR2GRAY - 改变频道号
- php - Laravel 作业推送到队列事件
- lua - 如何在 Lua 中将 HSL 转换为 RBG
- python - 递归赋值前引用的局部变量
- angular - 如何根据另一个汇总的 mat-cell 更改一个 mat-cell 值