Return Text Before Nth Instance of Particular Character

  • I have a series of functional locations that can go down to seven levels, separated by '-' within the text. I need to extract the text to the fifth level; however, there is not a standard number of characters per level. E.g.



    The result I would like for each of those is



    But of course there's a different number of characters in fifth level (and sometimes in the fourth, too), so instead I would like to eliminate text after the fifth "-" but googling isn't helping me find a way to do that.

    TIA for any help!