Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
快速提问。我该如何搭配
site.com/characters/
不匹配
site.com/characters/characters2
试图:
site.com/[a-zA-Z]+/?
快速回答:
你的方法非常好。您应该使用$(终止字符) 来指定匹配项。
$
site.com/[A-z]+/?$
只需在正则表达式模式的末尾添加一个“$”即可。表示字符串结束
site.com/[a-zA-Z]/$
您可以使用 www.debuggex.com 查看正则表达式。