Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8896587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:06:36+00:00 2026-06-15T00:06:36+00:00

I want to validate a URL, so I searched and found this Brian Ray

  • 0

I want to validate a URL, so I searched and found this

Brian Ray said in his post that

“@Tate’s answer is good for a full URL, but if you want to validate a domain column, you don’t want to allow the extra URL bits his regex allows (e.g. you definitely don’t want to allow a URL with a path to a file).

So I removed the protocol, port, file path, and query string parts of the regex, resulting in this:”

I don’t understand what he said at all. How can a URL be a path to a file? What is a “domain column”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:06:37+00:00Added an answer on June 15, 2026 at 12:06 am

    A URL consists of several parts. If you have a very eleborate URL, like:

    http://www.example.com:1234/path/to/file.html?key1=value1&key2=value2
    

    The parts are:

    • protocol: http://
    • host name: www
    • domain name: example.com
    • port: 1234
    • file path: path/to/file.html
    • query string: key1=value1&key2=value2

    The only parts that may not be omitted are the protocol (but many programs allow defaulting to http://) and host name. Each part has its own requirements for what are legal characters in it. And what’s worse, not all web servers agree on what those requirements are. So the only thing you can check without making an actual connection and seeing if it fails, is the part which is needed to contact the web server. This is only the protocol, host and domain name, and port. These are all case insensitive (the rest may not be). I’m not sure what are valid characters in a host or domain name, but this is also something where name servers may not agree with the specification.

    In short, the only way to check if an URL is valid is to try to make a connection to it. If your program uses some magic to reject URLs (or email addresses), some people are going to hate you and/or their internet provider for it (because even if your check follows the specification, some host or domain names don’t).

    As to your question how an URL can refer to a local file, there is a special protocol for that: file://. Since the path must start with a / as well, this results in URLs like file:///home/user/file.html, so with three slashes at the start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want validate a url that is a image e.g.: http://www.mydomain.com/image.jpg http://www.mydomain.com/image.png http://www.mydomain.com/image.jpeg http://www.mydomain.com/image.gif
For this example lets say I want to validate a google plus profile URL
I want to validate a URL in Rails using URI.Parse , by saying that
I want to validate a registration form that accepts an email address in the
I want make a simple referral system. Basically referral URL structure something like this.
I'm trying to validate URL. I want to make these URLs pass the validation:
I have this regular expression to validate the URL: ^[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$^ . This regular expression
I have a form that i want to validate ( show validation summary, show
I want to validate following kind of url's in jquery and in PHP at
I know there is filter_var() but I don't want to validate a URL, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.