0

kindly help in grep command

"a".upto ("z") {|i| print i} puts for i in 'a'..'z' print i end a="Hello Anand, how are yopu?\nare you ready? anand did that right?\tok we can meet again" a.grep(/are/) please help me... https://code.sololearn.com/cDEmO4wgzw8U/#rb

10th Dec 2018, 12:17 PM
Anand Raja
Anand Raja - avatar
1 Respuesta
+ 6
grep takes an array as input You should use scan if you have a string a="Hello Anand, how are yopu?\nare you ready? anand did that right?\tok we can meet again" print a.scan(/are/) http://iacutone.github.io/blog/2013/08/22/grep-and-scan-regular-expressions-in-ruby/
10th Dec 2018, 2:03 PM
Mert Yazıcı
Mert Yazıcı - avatar