Mega Code Archive

 
Categories / Ruby / String
 

Match alternate forms of a pattern using the pipe character ()

opening = "this is a test \nthis is a test ,\n" puts opening.grep(/th|te/)