regex - 为什么我的正则表达式包含过滤器不起作用(谷歌分析)?
问题描述
在谷歌分析中,我创建了以下包含过滤器:
^https:\/\/(my\..*|accounts\..*|maya\..*\/reports\/(mymessages|favorites)|maya\..*\/account\/notification|info\..*\/(heb|eng)\/management\/generalpages\/pages\/(personalfolder|registration|change_password|userssearchindex|security%20search)\.aspx).*
为了仅包含包含以下地址的URL :
https://my.tase.co.il
https://accounts.tase.co.il
https://maya.tase.co.il/reports/mymessages
https ://maya.tase.co.il/reports/favorites
https://maya.tase.co.il/account/notification
https://info.tase.co.ilManagement/GeneralPages/Pages/PersonalFolder.aspx
https: //info.tase.co.ilManagement/GeneralPages/Pages/Registration.aspx
https://info.tase.co.ilManagement/GeneralPages/Pages/Change_Password.aspx
https://info.tase.co.ilManagement/GeneralPages/ Pages/UsersSearchIndex.aspx
https://info.tase.co.ilManagement/GeneralPages/Pages/Security%20Search.aspx
但由于某种原因,我无法让它工作。我究竟做错了什么?
谢谢你的帮助!
解决方案
该模式与开头的链接不匹配,info.
因为该模式指定info\..*\/(heb|eng)
并且在示例数据中没有heb
或eng
存在。
您可以删除该部分或使用以这些 url 开头的完全匹配的模式:
https:\/\/(?:(?:accounts|my)\.tase\.co\.il|maya\.tase\.co\.il\/(?:reports\/(?:mymessages|favorites)|account\/notification)|info\.tase\.co\.il\/Management\/GeneralPages\/Pages\/(?:PersonalFolder|Registration|Change_Password|UsersSearchIndex|Security%20Search)\.aspx).*
查看正则表达式演示。
推荐阅读
- c++ - 我在 Windows 和 Linux 中得到了不同的结果!C++ 代码
- java - 无法在 SpringBoot 的控制器中正确重定向和制作控制器
- python - 如何通过方法包装器获取绑定到对象的底层函数的 id?
- javascript - Firebase 部署节点模块问题
- angular - 您如何确保 Angular 7 应用程序中没有匹配规范文件的文件的代码覆盖率?
- amazon-web-services - AWS Cloudwatch 警报在达到阈值后未触发
- postgresql - 如何阅读 Postgres 事务日志
- android - 如何从主方法的上下文中访问数据类值
- .net - 无法实例化类的代理。找不到无参数构造函数
- sql - 需要将符合条件的数据从一个表更新到另一个表