Announcement

Collapse
No announcement yet.

URL Validation => regex's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • URL Validation => regex's

    Hello... I found this regular expression for validating URL's which I want to use in my php script:
    Code:
    /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\//i
    I am not too good with reg ex's, but my current script in which I validate the URL has this as the validator conditional....
    Code:
    if(eregi('^([[:alnum:]\-\.])+(\.)([[:alnum:]]){2,4}([[:alnum:]/+=%&_\.~?\-]*)$', $_POST['homepage']))
    How do I go about getting the first regular expression above inside the if(eregi(...... , $_POST['homepage']))
    Thanks for all your help... it's truly appreciated!!!
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X