I don't know if it's more performant or the performance matters at all, but personally, I find

```ruby
%r{refs/tags/(.*)}.match(ref).first
```

easier to read. Also, we are assuming there is a match. Is that guaranteed?