#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    FTP validation regex


    Hello,

    I would like to find a regular expression to validate (in perl) a ftp url.
    For example: ftp://usernameassword@subdomain.example.com/path1/example.txt

    Someone can help me?

    Thank you so much
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,960
    Rep Power
    9397
    Google around for a regular URL regular expression, and them make sure (a) it supports FTP only, and (b) optionally (?) includes the username/password pair.

    How specific does it have to be? RFC correct, or just "pretty close"? If there's an error would you rather it be a false positive or false negative?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0
    Thanks for your quick response
    Ideally, the filter should be as standard as possible ... and if in doubt, always be negative

    I have not been able to find anything in Google: (


    Originally Posted by requinix
    Google around for a regular URL regular expression, and them make sure (a) it supports FTP only, and (b) optionally (?) includes the username/password pair.

    How specific does it have to be? RFC correct, or just "pretty close"? If there's an error would you rather it be a false positive or false negative?
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,960
    Rep Power
    9397
    Originally Posted by icsbcn
    I have not been able to find anything in Google: (
    Really? Add "ftp" or "perl" for even better results.

    Like I said, take one of those that includes the http prefix and allows for usernames+passwords and change it to use an ftp prefix instead.

IMN logo majestic logo threadwatch logo seochat tools logo