美元符号 ($)

美元符号匹配位于字符串结尾的前方和相邻的字符。

例如,end$ 可以匹配:

  • Temporarily suspend
  • We’re going off the deep end
  • Match the characters that prepend

但是,end$ 不会匹配:

  • Temporarily suspend.
  • We’re going off the deep end.
  • Match the characters that prepend.

前面 3 行都以 nd. 结束,而不是您要使用正则表达式匹配的 end 字符。

可以使用这种类型的正则表达式来创建匹配某个 URI 的细分、过滤条件或目标步骤。例如,如果您要通过测试来比较新的 .htm 版网页与旧的 .html 版网页哪个效果更佳,那么您就可以分别使用以下正则表达式来识别不同版本的网页:

  • email-signup\.htm$
  • email-signup\.html$

使用正斜线对点转义,确保对其按字面解释。

本页面可能包含使用 AI 技术翻译的内容。AI 翻译未必准确无误。

该内容对您有帮助吗?

您有什么改进建议?
false
搜索
清除搜索内容
关闭搜索框
主菜单
16232658571414555428
true
搜索支持中心
false
true
true
true
true
true
69256
false
false
false
false
false
⌂ 换网址