I need a regex to validate a URL.
Following are valid URL formats:
http://example.com
http://example.com/index.php
http://example.com/index.php#test
http://example.com/demo/index.php
http://example.com/demo/index.php#test
http://www.example.com
http://wwww.example.com
https://www.example.com
https://wwww.example.com
Following are invalid URL formats:
://example.com
http://example.com/index..php
http://example.com/index.php###test
http://example.com/de,mo/index.php
http://example.com/de!mo/index.php#test
http://ww.example.com
http://wwwww.example.com
htps://www.example.com
https:/wwww.example.com
http://wwww.example.com/.,.,.
http://wwww.exa_mple.com/