First things first: Never actually do this. This is just a fun curiosity, for amusement value only. Because of the way JavaScript’s search() method works, you can do: var my_url = 'http://kai.mactane.org'; if (! my_url.search(/http:\/\/kai.mactane.org/)) { alert("Your URL is http://kai.mactane.org"); } else { alert("Nope, your URL isn't http://kai.mactane.org"); } Try running this, and it will [...]