From: Micke Micke Date: 2009-07-15T18:20:52+09:00 Subject: Search in string with regular expression Hi all I'm trying to build a new string from a existing one. The original string is: my frog name is froggy I will pull out only: frog froggy I have tried the following: ---- str1 = 'my frog name is froggy' str2 = str1[/frog|froggy/] puts str2 --- This will print only the string: frog I can get the information with this code: ---- str1 = 'my frog name is froggy' str2 = str1[/frog] + " " + str1[/froggy/] puts str2 ---- This will print the string: frog froggy But i think it is possible to solve this in a better way, Any suggestions ? // Micke -- Posted via http://www.ruby-forum.com/.