You can use a negative lookbehind pattern like this:
s = ‘description 162544–Los A. Opera Co. - Music
Center-361485-5M-data-note:’
s.split /(?<!\)-/
=> [“description 162544”, “”, “Los A. Opera Co. \- Music Center”,
“361485”, “5M”, “data”, “note:”]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.