Long Lived branches filter not working for branch under folder

We have used below filter in SonarCloud to define all branches inside squad folder as long lived but it shows squad branch as short lived after scanning. Can you please guide on this regex to include squad branch as long lived, nothing mentioned in docs for folder based branching.

Long-lived branches pattern:(master|develop|release|(squad/*))

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Languages of the repository - IOS Swift


Let’s look at your regex:

  • () - this defines a group
  • | - within the group, this delineates alternatives

Together in your regex, they set up a group with 4 items

So with ‘(master|develop|release|(squad/*))’ what we’ve got is:

master or develop or release or the group squad/*

Now, I’ll be honest. Since there are no alternatives in your squad/* sub-group, I’m not sure what effect the extra parentheses are having (perhaps they’re being interpreted literally?) but the first step would be to drop them.

Now, that leads me to the /* part of the pattern. Do you really have /s in your branch names? If so, this could be problematic.

You’ve said:

What does this actually translate to in terms of the literal names of the branches?


Literal names of branches are in the form of squad/a, squad/b, squad/anotherfolder/abc, etc.
If we can atleast make this work for branches under the folder squad, that would also work.


I have misgivings about the ‘/’ since that’s normally a path delimiter…

The default pattern is: (branch|release)-.*
I.e. branch or release followed by a literal - followed by anything (.*)
Which would match branch-foo or release-6.9.

So try: (master|develop|release|squad)/.*
That is, branch or develop or release or squad followed by a literal / followed by anything (.*).