Description
This regex will validate the url's contain either try.github.io
or gethub.com
^https?:[\/]{2}(try[.]github[.]io|github[.]com)

Example
I don't know python so I'm providing a php example to show how the regex works.
<?php
$sourcestring="your source string";
preg_match_all('/^https?:[\/]{2}(try[.]github[.]io|github[.]com)/im',$sourcestring,$matches);
echo "<pre>".print_r($matches,true);
?>
$matches Array:
(
[0] => Array
(
[0] => http://try.github.io
[1] => https://github.com
)
[1] => Array
(
[0] => try.github.io
[1] => github.com
)
)
Disclaimer
It would probably be easier to use your urlparse
solution and then just apply some logic to test the [1]
returned value.