Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
([\w][\w\d-]+\.[\w\d]{2,3})$
/
gmi

Description

I need to get the top level domain from the request header but it can be in a vary ways.. how can I match but exclude parts I dont want to get ie. ports

Submitted by nei - 10 years ago