Quantcast
Channel: URL Validation function improving - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Josha Inglis for URL Validation function improving

$
0
0

This would be my attempt:

((?:http|https)://)?(?:www\\.)?[\\w\\d\\-_]+\\.\\w{2,3}(\\.\\w{2})?(/(?<=/)(?:[\\w\\d\\-./_]+)?)?

EDITAdded in a back-reference (?<=/)for extra specificity

EDIT 2Added optional search for country name in URL (eg www.google.com.in)


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>