File: url_validator.php.inc

package info (click to toggle)
sarg 2.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,456 kB
  • sloc: ansic: 17,692; sh: 4,581; xml: 371; javascript: 352; php: 205; makefile: 183; sed: 16; pascal: 2
file content (11 lines) | stat: -rw-r--r-- 281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
<?php

function check_url($url)
{
	/*
		Regex is @gruber as found at https://mathiasbynens.be/demo/url-regex

		Thanks Mathias for sharing those regex in a clear table.
	 */
	return(preg_match("#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#i", $url)===1);
}