正则指南
例如
rafael.com
hello.rafael.com
hi.hello.rafael.com
匹配
hello.rafael.xyz
badrafael.com
rafaelbad.com
rafaelbad.xyz
badrafael.xyz
arafael.com
arafael.xyz
rafael.xyz
a.b.rafael.xyz
此表达式。*rafael(?!\。com)。*
让我成为一部分,但是它不匹配,例如,
badrafael.com
arafael.com
我被赶上了这个外观的部分正则是我一直盯着这个3个小时,无法弄清楚。任何指导,建议,链接与示例的链接都将不胜感激!
I am struggling to complete this regex condition:
"Match anything that is not a legitimate subdomain of rafael.com (including the domain rafael.com)"
For example, these 3 lines should not match because they are legitimate
rafael.com
hello.rafael.com
hi.hello.rafael.com
And all the lines below should match
hello.rafael.xyz
badrafael.com
rafaelbad.com
rafaelbad.xyz
badrafael.xyz
arafael.com
arafael.xyz
rafael.xyz
a.b.rafael.xyz
This expression .*rafael(?!\.com).*
gets me part of the way, but it isn't matching, for example,
badrafael.com
arafael.com
I am getting caught up with the lookbehind portion of this regex, I have been staring at this for 3 hours and can't figure it out. Any guidance, suggestions, links to examples would be tremendously appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在大量故障排除之后,我已经决定,最好的方法实际上是为某些最常见的场景创建单独的回答,这些反行率是在阻止域名及其组合时可能出现的,并创建了1个以上的规则,而不是试图试图尝试捕获1正则域中域的每一个可能的组合。
I have decided after much troubleshooting that the best way to do this is actually to create separate regexes for some of the most common scenarios that may come up when blocking domain names and their combinations, and create more than 1 rule, as opposed to trying to capture every single possible combination of a domain in 1 regex.