Regular Expressions 101

Community Patterns

Match URI with grouped URL syntaxes

0

Regular Expression
ECMAScript (JavaScript)

/
(?:(?<Protocol>https?):\/\/)?(?:(?<Subdomain>[\w\.]+)?\.)?(?<Hostname>\w+)\.(?<Domain>\w+)\:?(?<Port>\d+)?(?<Path>\/.*)?
/
g

Description

Validate (although, not recommended) URI scheme, and separate the URI syntax with multiple groups.

Submitted by outrowed - 3 years ago