What does the ?!
mean in the following regex expression?
new RegExp('http:\/\/(?!' + location.hostname + ')')
(often represented by any of ?!, !?, ?!? or !?!), is an unconventional punctuation mark used in various written languages and intended to combine the functions of the question mark, or interrogative point, and the exclamation mark, or exclamation point, known in the jargon of printers and programmers as a "bang".
What Is an Interrobang? An interrobang (sometimes called an interabang or exclamation question mark) is a nonstandard double punctuation mark that combines the glyphs and functions of the question mark and exclamation point. The glyph for an interrobang is ‽, but you can also write it as !?, ?!, or ?!?
That combination of a question mark and an exclamation mark is called an interrobang (or interabang) and it is actually a question mark superimposed on an exclamation mark. It can be used when a question is exclaimed.
The interrobang combines the question mark (?) and the exclamation point (!) into a single punctuation mark. It conveys a question asked in an excited way. For example: Are you really coming over to my house on Friday‽
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's a negative lookahead, you can check here for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With