Regular Expressions 101

Extract port from URL

Open Workspace
  • PCRE (Legacy)
  • Match
1

Regular Expression

/
(^([A-Z]*)((:\/\/)?)([A-Z\d\.-]{2,})\.([A-Z]{2,}):(\d{2,5})?)
/
i

Description

Extracts the port from different possible forms of URL

Submitted by Anonymous