Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(github.com|gitlab.com)\/([A-Za-z0-9-_]+)\/([A-Za-z0-9-_]+)
/
gm

Description

Detects github and gitlab urls and gives back the domain (either github.com or gitlab.com) and the author + repo name

Submitted by anonymous - 6 years ago