Mega Code Archive

 
Categories / Ruby / String
 

Match the first line just by using a word in the pattern

opening = "this is a test\n this is another test,\n" p opening.grep(/is/)