Validating a suggested web link in a form
I could do it through PHP but I would prefer this time to check when the user tries to submit the form and an alert to appear when the link is invalid.
this is where I'm at...reg exp
looks weird eh?
/^(file|http) checks if the first words are 'file' or 'http'
then a ':' is required.
the \/\/ escapes '//'s which are in the URL. \S+ is any number of any non-white space characters. Then another single \/ (checks for '/' in url) and another \S+ then a '.' then check for gif OR jpg all reg exp ends in $/ and the i allows for lower or uppercase letters.
I'm finaly get my head round it!!!