regex-group - 谷歌事件的正则表达式
问题描述
您好,我想帮助编写一个正则表达式来捕获所有带有单词确认的网址。
例如: https ://example.com/this-is-a-confirmation
https://example.com/confirmation
https://example.com/folder/this-is-confirmation
我正在尝试设置一个目标,以捕获对网站上任何确认页面的所有访问,因为通过访问该页面,您很可能填写了表格以下载资产
谢谢!
解决方案
那么,基本上所有链接都以确认结束?
然后你可以使用一个非常愚蠢和简单的正则表达式,比如:
confirmation$
如果您只希望 URL 包含确认:
confirmation
已经足够了(Demo)。String.endsWith(str)
这与您使用and基本相同String.contains(str)
。
根据您评估的方式,您可能需要在搜索词之前允许字符产生完全匹配(不仅仅是部分匹配):
.*confirmation
或者
.*confirmation.*
如果您想在搜索词之后允许任何文本。
推荐阅读
- timeout - Amazon EC2 实例(Windows 服务器)获得定时
- wordpress - get_template_directory_uri VS get_theme_file_uri 哪个更好,为什么?
- javascript - 特定网站的反向图像搜索
- reactjs - 视口元标记不适用于 Google Chrome
- airflow - Google Cloud Composer 服务器遇到临时错误,无法完成您的请求
- php - PHP 回显打印超出我的 html 范围
- python - 向 django auth 用户添加字段?
- html - 使用 VBA 导航 IE HTML 文档中的 href
- makefile - 为什么这个 VLC 媒体播放器构建失败?
- java - 在一个数组中找到两个总和相同的子集