Regular Expressions 101

Community Patterns

Extract domain from URL

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)
/
igm

Description

Extract the domain out of an url

Submitted by anubhava - 8 years ago