I'm facing syntax issue
($CI_COMMIT_BRANCH =~ /^[A-Z][0-9][-_]SPRINT[0-9]+/i)
($CI_COMMIT_BRANCH =~ /^SPRINT[0-9]+/i)
($CI_COMMIT_BRANCH =~ /^[A-Z]SPRINT[0-9]+/i)]
(SPRINT-branch name) can you please help me to combine these split sequence into single command line
You can use:
^([A-Z]([0-9][-_])?)?SPRINT[0-9]+
^
Start of string(
Start a group
[A-Z]
Match a single char A-Z([0-9][-_])?
Optionally match a digit 0-9 and either -
or _
)?
Close the group and make it optionalSPRINT[0-9]+
The code can look like
($CI_COMMIT_BRANCH !~ (/^([A-Z]([0-9][-_])?)?SPRINT[0-9]+/i))
See the matches in this regex 101 demo.