Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Cheung pchc2005

  • HK
View GitHub Profile
@pchc2005
pchc2005 / regex-weburl.py
Created Sep 20, 2018
A python port for regex-weburl.js by @dperini
View regex-weburl.py
import re
URL_REGEX = re.compile(
u"^"
# protocol identifier
u"(?:(?:(?:https?|ftp):)?//)"
# user:pass authentication
u"(?:\S+(?::\S*)?@)?"
u"(?:"
# IP address exclusion
# private & local networks
View regex-weburl.js
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
You can’t perform that action at this time.