Skip to content

@Romoku /userdomainmultilineregex.txt
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
User Domain Multiline Regex
Usage:
<username><space><subdomain>*<.><domain><.><TLD>
((\w|\d)+)\s((((?<=.).*.(\w|\d)+)|(?<=\s)(\w|\d)+).(\w+(?<=\w+).\w+)|\w+)$
((\w|\d)+) # Captures the Username which can be a word or digit (will require validation)
\s # separate domain by a space
( # capture the domain
( # Capture either a multipart domain (subsubdomain.subdomain.domain)
((?<=.).*.(\w|\d)+) # do a negative lookbehind to see if we have a subdomain and a capture anything (.*) for the subdomain up to the space
| # or a singular domain (domain)
(?<=\s)(\w|\d)+ # use a negative lookbehind to find a space that separates the username
)
. # Separate the domain
(\w+(?<=\w+).\w+) #Do a negative lookbehind to check for multipart subdomain
|
\w+ # default to (single tld)
) # look for either a multipart tld (.co.uk) or a regular tld (.com)
$ #Start at the end of the line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.