Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
<(https?:\/\/[\w-]+(?:\.[\w]+)+(?:\/[\w-?=%&@$#_.+]+)*\/?)(?:\|((?:[^>])+))?>
/
g

Description

This regex is a duplicate of another one, but with a minor modification to support subdomains with one or more "-" in it.

ie: <https://sub-domain.example.com|Link to example.com>

Submitted by Dylan - 8 years ago