INNER CODE UNIT · TypeScript
regex
KinsonDigital/Velaptor · DevTools/create-pr.ts:135
const regex = /^[a-zA-Z\-]+$/gm;
// Remove leading and trailing hyphens, trim, lowercase, and replace spaces and underscores with hyphens
value = value.trim().toLowerCase()
.replaceAll(" ", "-")
.replaceAll("_", "-")
.replace(/-{2,}/g, "-")
.replace(/^-+/, "")
.replace(/-+$/, "");
if (!regex.test(value)) {
printIndianRed(
"Branch name must match the pattern 'feature/123-my-branch'.",
);
return false;
}
return true;