Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?<initial_commit>Initial commit\.?)|(?<merge>Merge [^\r\n]+)|(?<type>build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|¯\\_\(\)_\/¯)(?:\((?<scope>[\w-]+)\))?(?<breaking>!)?: (?<summary>[\w ,'.`:-]+)(?<=\v\v){0,2}(?<body>[\w\s,'.`\[\]-]+)(?<footer>(?<=\v\v)(?:(?<footer_token>[\w\s-]+): (?<footer_value>[\w -`]+))+|$))
/
gm

Description

This regex matches most of the rules of conventional commits .

Submitted by Ahmed Kamal - 2 years ago