What can I use instead of (.grep)?

Hi,

I am new to ruby and to programming in general. I am learning from an outdated book and just realized that the .grip method can no longer be used on strings since ruby 1.9.

My question is could you please recommend an alternative method that I could use instead of grep and works on strings?

Sincerely,

Lorant

Hi,

I am new to ruby and to programming in general. I am learning from an outdated book and just realized that the .grip method can no longer be used on strings since ruby 1.9.

My question is could you please recommend an alternative method that I could use instead of grep and works on strings?

Old: string.grep(/re/)

New: string =~ /re/