Validating a URL

This function validates a URL using regular expressions. You can specify the prefixRequired parameter (set it to true) to force the function to only accept URLs starting with http://, https://, or ftp://, otherwise this prefix will be optional.