ruby regex - how to match everything up till the character -

Viewed 26531

given a string as follow:

randomstring1-randomstring2-3df83eeff2

How can I use a ruby regex or some other ruby/rails friendly method to find everything up until the first dash -

In the example above that would be: randomstring1

Thanks

4 Answers
Related