Regular Expressions 101

Community Patterns

git url dissecting

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^((?<protocol>https?|ssh|git|ftps?):\/\/)?((?<user>[^\/@]+)@)?(?<host>[^\/:]+)[\/:](?<port>[^\/:]+)\/(?<path>.+\/)?(?<repo>.+?)(?<suffix>\.git[\/]?)?$
/

Description

Loading markdown...
Submitted by anonymous - 3 months ago