How to do a conditionnal sum based on a string in an array?

When you mentioned

and

it is not clear if you to match both /bidule and /bidule/1 because to me /bidule/1 is like /bidule but it is not equal.

So using the 2 documents you shared and the input string /bidule, would the answer be 33 because only /bidule is equal to /bidule, or would the answer be 133 because both /bidule and /bidule/1 are both like /bidule.

What if the input string is /bidule/1?

What if the input string is /bidul?

If would be nice if you could create a playground with your sample documents. The single line format is not the easiest to work with.