Regular Expressions 101

Community Patterns

Match Root Domain

0

Regular Expression
ECMAScript (JavaScript)

/
((http|https?)?(.+?\.?)(retailstore.com)(.+?\.?)?)
/
ig

Description

This is meant to match a specific root domain in certain formats. For example, I'm excluding the root domain by itself as that could be what is written in the documentation, but in links, or code, it would usually have a subdomain and protocol attached.

Submitted by Joseph - 2 years ago