有什么用?!吝啬的? [英] What does ?! mean?
本文介绍了有什么用?!吝啬的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
?!
在下面的正则表达式中是什么意思?
What does the ?!
mean in the following regex expression?
new RegExp('http:\/\/(?!' + location.hostname + ')')
推荐答案
这是一个否定前瞻,表示要匹配表达式,(?!...)
中的部分不能匹配.在这种情况下,正则表达式匹配 http://
only 当它后面没有当前主机名时(粗略地,请参阅 Thilo 的评论).
It's a negative lookahead, which means that for the expression to match, the part within (?!...)
must not match. In this case the regex matches http://
only when it is not followed by the current host name (roughly, see Thilo's comment).
这篇关于有什么用?!吝啬的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文