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


given string follow:

randomstring1-randomstring2-3df83eeff2 

how can use ruby regex or other ruby/rails friendly method find until first dash -

in example above be: randomstring1

thanks

you can use pattern: ^[^\-]*


Comments

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -