Mega Code Archive

 
Categories / Ruby / Development
 

Search for a word from the very beginning

line = "A horse! a horse! my kingdom for a horse!" line[/^A horse/, 0] # => "A horse"