Linkify some other text:
Some things probably shouldn't match:
- test.xyz
- test.xyz/
- test.xyz/foo
- [test.xyz]
- [test.xyz/]
- [test.xyz/foo]
- "http://benalman.a"
- "http://benalman.a/"
- [http://benalman.com]x
- 100.200.300.400
- 1000.2.3.4
- 1.2.3
- 100.200.300.400/foo
- 1000.2.3.4/foo
- 1.2.3/foo
- a1.2.3.4
- 1.2.3.4a
- example.coma
- -example.coma
- path:to:file.pm
- /path/to/file.pl
But many things should:
- This is a bad link test.xyz/ and a few linkinus2-reg://a-b-c good 1.2.3.4 links [http://benalman.com] http://benalman.com/(url) together (http://benalman.com/(url)) here.
- This is a bad link 100.200.300.400/foo and a few example.com good example.com?x=1 links http://[email protected] together "http://benalman.com/(url)" "http://benalman.com/" here.
- some bold and italics: benalman.com, benalman.com/, benalman.com/foo, http://benalman.com, http://benalman.com/, [email protected]
- test (benalman.com), and (http://benalman.com/), and [foo.com,] {bar.com!}
- International domain names føøbár.ch (føøbár.ch) "føø-bár.ch" føø.bár.ch føøbár.ch/føø/bár should be linkified, but føø_bár.ch is not valid
- linkinus2-reg://a-b-c
- <1.2.3.4>
- <http://1.2.3.4>
- <http://1.2.3.4/>
- «http://1.2.3.4/»
- "http://1.2.3.4/"
- <http://1.2.3.4/>
- "http://1.2.3.4/"
- [email protected]
- mailto:[email protected]
- "[email protected]"
- "mailto:[email protected]"
- [email protected]?
- mailto:[email protected]?
- [email protected].
- mailto:[email protected].
- [email protected]?subject=Test%20subject&body=Hello%20there!
- ftp.example.com
- irc.example.com
- ftp://ftp.example.com
- irc://irc.example.com
- ftp.example.com/foo
- irc.example.com/foo
- ftp://ftp.example.com/foo
- irc://irc.example.com/foo
- a 1.2.3.4
- 1.2.3.4 a
- a 1.2.3.4 a
- 1.2.3.4
- 1.2.3.4/foo
- ftp://1.2.3.4
- ftp://1.2.3.4/foo
- 101.102.103.104
- [email protected]
- omg-ponies://this:is:some:crap
- a [http://benalman.com]
- [http://benalman.com] b
- a [http://benalman.com] b
- [http://benalman.com]
- [http://benalman.com]
- [http://benalman.com]
- [http://benalman.com/]
- (http://benalman.com)
- (http://benalman.com/)
- "http://benalman.com"
- "http://benalman.com/"
- http://benalman.com/(url)
- "http://benalman.com/(url)"
- (http://benalman.com/(url))
- example.com
- example.com/
- example.tv
- example.tv/
- example.com?
- example.com/?
- (foo.com)
- "foo.com"
- [foo.com]
- [foo.com/]
- [foo.com/test]
- [foo.com/test/]
- example.com/foo
- example.com/foo/
- example.com?x=1
- example.com#y=2
- example.com?x=1#y=2
- example.tv
- test.example.com
- file:///foo.txt
- http://benalman.com
- http://benalman.com/
- http://benalman.xyz
- http://benalman.xyz/
- http://benalman.com?
- http://benalman.com/?
- http://benalman.xyz?
- http://benalman.xyz/?
- http://benalman.com"
- http://benalman.com/"
- http://benalman.xyz"
- http://benalman.xyz/"
- http://[email protected]
- http://foo:[email protected]
- http://benalman.com:81
- http://benalman.com:81/
- http://[email protected]:81/
- https://[email protected]:81/
parseuri examples
- http:
- https://
- http://host
- http://host/
- http://host.com
- http://subdomain.host.com
- http://host.com:81
- http://[email protected]
- http://[email protected]:81
- http://user:@host.com
- http://user:@host.com:81
- http://user:[email protected]
- http://user:[email protected]:81
- http://user:[email protected]:81?query
- http://user:[email protected]:81#anchor
- http://user:[email protected]:81/
- http://user:[email protected]:81/?query
- http://user:[email protected]:81/#anchor
- http://user:[email protected]:81/file.ext
- http://user:[email protected]:81/directory
- http://user:[email protected]:81/directory?query
- http://user:[email protected]:81/directory#anchor
- http://user:[email protected]:81/directory/
- http://user:[email protected]:81/directory/?query
- http://user:[email protected]:81/directory/#anchor
- http://user:[email protected]:81/directory/sub.directory/
- http://user:[email protected]:81/directory/sub.directory/file.ext
- http://user:[email protected]:81/directory/file.ext?query
- http://user:[email protected]:81/directory/file.ext?query=1&test=2
- http://user:[email protected]:81/directory/file.ext?query=1#anchor
- //host.com
- //user:[email protected]:81/direc.tory/file.ext?query=1&test=2#anchor
- /directory/sub.directory/file.ext?query=1&test=2#anchor
- /directory/
- /file.ext
- /?query
- /#anchor
- /
- ?query
- ?query=1&test=2#anchor
- #anchor
- path/to/file
- localhost
- 192.168.1.1
- host.com
- host.com:81
- host.com:81/
- host.com?query
- host.com#anchor
- host.com/
- host.com/file.ext
- host.com/directory/?query
- host.com/directory/#anchor
- host.com/directory/file.ext
- host.com:81/direc.tory/file.ext?query=1&test=2#anchor
- [email protected]
- [email protected]:81
- [email protected]/
- [email protected]/file.ext
- [email protected]?query
- [email protected]#anchor
- user:[email protected]:81/direc.tory/file.ext?query=1&test=2#anchor