我正在尝试创建一些与网站域匹配的正则表达式模式。
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
我有这些适用于法国和德国的正则表达式模式,效果很好:
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相匹配。
也许我错过了一些明显的东西。
非常感谢您的帮助。