http://www.google.com
Cod: Selectaţi tot
var X = /^([http?]:\/\/{1})+([www.]{1})+([^A-Za-z0-9]+)+([\.]{1})+([^A-Za-z0-9]+)$/i;
Cod: Selectaţi tot
var X = /^([http?]:\/\/{1})+([www.]{1})+([^A-Za-z0-9]+)+([\.]{1})+([^A-Za-z0-9]+)$/i;
Cod: Selectaţi tot
<script>
var urlexp = new RegExp('(http[s]?:\\/\\/(www)?|ftp:\\/\\/(www)?|www){1}\\.([0-9A-Za-z]{2,8})+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?');
var someurl ='https://www.google.com/dir/page.ext?id=ab%20xy+o';
if(someurl.match(urlexp)) alert('It is an url address');
else alert('Not an url address');
</script>