URL validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divyac11
    New Member
    • Nov 2008
    • 3

    URL validation

    Please help me to generate a code for valid URL under the following circumstances.
    A valid URL should be one that:

    * May or may not include http://
    * Should not contain a space
    * Should not contain invalid URL characters in the domain name part
    * May contain entities such as %20 or + in the URL after the domain name part
    * If there are query parameters, there must be a ? mark
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    and, er, what is that suposed to do? usually you do this by checking your typed url.... or do you actually want a function, that validates a given url for you? in this case you can use a regular expression.

    regards

    Comment

    • divyac11
      New Member
      • Nov 2008
      • 3

      #3
      I am a new one in PHP.
      Would you please give me the required regular expression



      Originally posted by Dormilich
      and, er, what is that suposed to do? usually you do this by checking your typed url.... or do you actually want a function, that validates a given url for you? in this case you can use a regular expression.

      regards

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        since regular expressions are hard to read if you're not accustomed to them I recommend reading a tutorial first. once you have that done, setting up your own RegEx should be not that difficult any more, but if you're running into problems we're here to help.

        regards

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Divyac, it is a general understanding here at bytes.com that we do not 'give' anything. Post the code you have tried, and we will help you with that.

          Comment

          Working...