正则表达式仅选择主页和index.html

时间:2018-12-04 12:52:02

标签: regex

我正在尝试通过正则表达式选择首页和index.html(它们是同一页面),但到目前为止还算不上成功。

我想要什么:

example.com

example.com/index.html

我不想要的东西:

example.com/everything-else

这是我尝试过的

\.com|index.html -> Selects index.html only. No other pages on the website but nor the .com either

/^\.ie$/|index\.html -> No luck

环境-Google跟踪代码管理器 它使我能够基于页面触发某些事件,我正尝试使用正则表达式选择这些页面。

1 个答案:

答案 0 :(得分:0)

找到一种方法:

/(index.html)?$

仍然感谢您的帮助:]