Regular Expressions 101

Community Patterns

Capture only top-level (root) domain in URL

4

Regular Expression
PCRE (PHP <7.3)

/
^(?:(?:http[s]?|ftp):\/)?\/?(?:[^:\/\s]+?\.)*([^:\/\s]+\.[^:\/\s]+)
/

Description

no description available

Submitted by guyfawkes - 9 years ago