Seriously, how did you find that?

```js
"test http://xn--r8jz45g.xn--zckzah/ test".match(/(?:([a-z]+|[A-Z]+)(?::|%[0-9a-fA-F]{2}))?(?:(?:(?:\?|%[0-9a-fA-F]{2})xt(?:=|%[0-9a-fA-F]{2})urn(?::|%[0-9a-fA-F]{2})[^\s<>]*)|(?:\/{2}|(?:%[0-9a-fA-F]{2}){2})?(?:\S+(?::\S*)?(@))?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]){1,3})|([a-zA-Z\u00a1-\uffff0-9][a-zA-Z\u00a1-\uffff0-9\-\.]+)(\.([a-zA-Z\u00a1-\uffff0-9]{2,})))(?::\d{2,5})?((?:[\/#]|%[0-9a-fA-F]{2})[^\s<>]*)?)/g)
["http://xn--r8jz45g.xn"]
```

It should have been `["http://xn--r8jz45g.xn--zckzah/"]`

```js
"http://例え.テスト/".match(/(?:([a-z]+|[A-Z]+)(?::|%[0-9a-fA-F]{2}))?(?:(?:(?:\?|%[0-9a-fA-F]{2})xt(?:=|%[0-9a-fA-F]{2})urn(?::|%[0-9a-fA-F]{2})[^\s<>]*)|(?:\/{2}|(?:%[0-9a-fA-F]{2}){2})?(?:\S+(?::\S*)?(@))?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]){1,3})|([a-zA-Z\u00a1-\uffff0-9][a-zA-Z\u00a1-\uffff0-9\-\.]+)(\.([a-zA-Z\u00a1-\uffff0-9]{2,})))(?::\d{2,5})?((?:[\/#]|%[0-9a-fA-F]{2})[^\s<>]*)?)/)
["http://例え.テスト/", "http", undefined, "例え", ".テスト", "テスト", "/"]
/^(?:a(?:e(?:ro)?|r(?:pa)?|s(?:ia)?|[cdfgilmnoqtuwxz])|b(?:iz?|[abdefghjmnorstvwyz])|c(?:at?|o(?:(?:op|m))?|[cdfghiklmnrsuvxyz])|i(?:n(?:(?:fo|t))?|[delmoqrst])|j(?:o(?:bs)?|[emp])|m(?:o(?:bi)?|u(?:seum)?|il|[acdeghklmnpqrstvwxyz])|n(?:a(?:me)?|et?|[cfgilopruz])|o(?:rg|m)|p(?:ost|ro?|[aefghklmnstwy])|t(?:el|r(?:avel)?|[cdfghjklmnoptvwz])|xxx|e(?:du|[ceghrstu])|g(?:ov|[abdefghilmnpqrstuwy])|d[dejkmoz]|f[ijkmor]|h[kmnrtu]|k[eghimnprwyz]|l[abcikrstuvy]|qa|r[eosuw]|s[abcdeghijklmnorstuvxyz]|u[agksyz]|v[aceginu]|w[fs]|y[etu]|z[amw])$/i.test("テスト")
false
```

It should have been `true`.
Same goes if the tld is `xn--*`.

You're trying to be as accurate as possible but you just fail at it, we don't need the ultimate, fail-proof URL regexp, it's too complex for 4chan X.
You probably don't respect the following [domain syntax rules](http://en.wikipedia.org/wiki/Domain_name#Domain_name_syntax) either, so why try so hard?

>This tree of labels may consist of 127 levels.
>Each label may contain from 1 to 63 octets.
>The empty label is reserved for the root node.
>The full domain name may not exceed a total length of 253 ASCII characters in its textual representation.

I don't even know what you're trying to match with that regexp anyway, but basically for http(s) URLs we need to match:

```
scheme://whatever as long as there something, at least a point and more things but no space or / and perhaps a point at the end(/anything that's not a space)?
```

http://en.wikipedia.org/wiki/URI_scheme

>The scheme name consists of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-"). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. It is followed by a colon (":").

```coffeescript
regex = ///
  [a-z][a-z0-9.+-]+://[^\s/\]+\.[^\s/\]+\.?(/\S*)? # HTTP(S) (or not) URLs
  | magnet:whatever # magnet URLs, I don't even know what to match https://en.wikipedia.org/wiki/Magnet_URI_scheme
  | mail@etc        # https://en.wikipedia.org/wiki/Email_address#Syntax
///
```
That's already a lot more readable, and it will actually work with public and private URLs, correct and incorrect ones, and that's **not** a problem.