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

c# - SharpSVN - How to get the previous revision? -

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

url - Querystring manipulation of email Address in PHP -