# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/^(?:\[[A-Z]*-\d* \\/fixed\] )?(?<type>\w*)(?:\((?<scope>[\w$.\-*\\/ ]*)\))?: (?<subject>(?:.(?!(?i)\\/fixed))*)$/$type $scope $subject/gm;t' <<< "# without scope
feat: add REST endpoint /my-app/api/versions
fix: change git commit username
style: set indentation to 4 spaces
docs: explain new configuration preset
# with scope
feat(backend): add REST endpoint /my-app/api/versions
fix(default): change git commit username
style(npm): set indentation to 4 spaces
docs(terraform): explain new configuration preset
# smartcommit without scope
[CORE-1234 /fixed] feat: add REST endpoint /my-app/api/versions
[HDEFECT-1234 /fixed] fix: change git commit username
[HDEFECT-1234 /fixed] style: set indentation to 4 spaces
[HDEFECT-1234 /fixed] docs: explain new configuration preset
# smartcommit with scope
[CORE-1234 /fixed] feat(backend): add REST endpoint /my-app/api/versions
[HDEFECT-1234 /fixed] fix(default): change git commit username
[HDEFECT-1234 /fixed] style(npm): set indentation to 4 spaces
[HDEFECT-1234 /fixed] docs(terraform): explain new configuration preset
# not match - wrong smart commit
[core-1234 /fixed] feat(backend): add REST endpoint /my-app/api/versions
[hdefect-1234 /fixed] fix(default): change git commit username
[hdefect-1234 /fixed] style(npm): set indentation to 4 spaces
[hdefect-1234 /fixed] docs(terraform): explain new configuration preset
# not matched - use /fixed in title
[CORE-1234 /fixed] feat(backend): add REST endpoint /my-app/api/versions /fixed
[HDEFECT-1234 /fixed] fix(default): change git commit /fixed username
[HDEFECT-1234 /fixed] style(npm): set /FIXED indentation to 4 spaces
[HDEFECT-1234 /fixed] docs(terraform): /fixed explain new configuration preset
"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html