Forum Moderators: coopster
[sub.domain.com...]
(mainly the part after dir (I guess))
This is the function:
function control_url($in) {
$start_url = "(http(s)?\:\/\/)?"; // start URL
$dots = "([\w_-]{2,}\.)+"; // one or more parts containing a '.' at the end
$last_part = "([\w_-]{2,})"; // last part doesn't contain a dot
$user = "((\/)(\~)[\w_-]+)?((\/)[\w_-]+)*"; // maybe subdirectories - possibly with user ~
$end = "((\/)¦(\/)[\w_-]+\.[\w]{2,})?"; // maybe a slash at the end or slash+file+extension
$qstring1 = "((\?[\w_-]+\=([^\#]+)){0,1}"; // querystring - first argument (?a=b)
$qstring2 = "(\&[\w_-]+\=([^\#]+))*)?"; // querystring - following arguments (&c=d)
$bkmrk = "(#[\w_-]+)?"; // bookmark
$exp = "/^".$start_url.$dots.$last_part.$user.$end.$qstring1.$qstring2.$bkmrk."$/i";
return preg_match($exp, $in);
}
Does anyone know the regular expression to get aboving url (which is indeed correct) through?