each part of this regex works alone but when i string them together it does not match a url with http or www followed by one of the listed TLDs.
(preg_match('/http\:\/\/(www\.)?[a-z](\.com|\.org|\.net|\.mil|\.edu|\.COM|\.ORG|\.NET|\.MIL|\.EDU)$/', $bandUrl))
You probably left out the
+after[a-z](which btw is not correct to match all valid URLs). And instead of listing both uppercase and lowercase .TLDs, you could use the/iflag:Btw, as alternative you could use
filter_var($url, FILTER_VALIDATE_URL)for testing.