正则表达式和负面展望

Regex and negative look ahead

我正在尝试创建一些匹配网站域的正则表达式模式。

规则如下:

For France, the URL pattern must have /fr-fr (followed by anything else) after the domain name, ie www.domain.com/fr-fr/anything
For Germany, the URL pattern must have /de-de (followed by anything else) after the domain name, ie www.domain.com/de-de/anything
And for all other countries, the URL pattern can be the root domain (ie www.domain.com) OR anything EXCEPT fr-fr and de-de after the domain name 

我有这些适用于法国和德国的 Regex 模式,效果很好:

https?://www.domain.com.*?/(?i)FR-FR.\*

https?://www.domain.com.*?/(?i)DE-DE.\*

但是,我正在努力获得一个正则表达式模式,该模式将匹配根域和其他域(例如 www.domain.com/en-us 及其后的任何内容)但 EXCLUDE /fr-fr.* and /de-de.*

我试过一个负面的前瞻,比如这个(例如,不是法国):

https?://www.domain.com.*?/(?!fr-fr).\*

但这似乎不起作用,并且与它不应该匹配的 URL 相匹配。

也许我遗漏了一些明显的东西。

非常感谢任何帮助。

只有 "Germany" 个网址:

^(?i)https?://www.domain.com(:\d+)?/de-de(/.*)?$

只有 "France" 个网址:

^(?i)https?://www.domain.com(:\d+)?/fr-fr(/.*)?$

既不是 "Germany" 也不是 "France"

的 URL
^(?i)https?://www.domain.com(:\d+)?(?!/fr-fr|/de-de)(/.*)?$