B
Boucher, Eric
Hi,
I want to see if a certain pattern is inside an array. I tried:
myArray.flatten.include?(/myPattern/)
but it always return false. Why? Is it because the "include?" doesn't takes
regular expressions?
Here's another example that I tried inside an irb session:
data = ["TC_TP1", "TC_TP2", "TC_TP3"]
=>["TC_TP1", "TC_TP2", "TC_TP3"]
data.include?(/TC_TP/)
=> false
data.include?(/TC_TP.*/)
=> false
data.include?(/TC_TP1/)
=> false
data.include?("TC_TP1")
=> true !!!
Thanks for your help.
I want to see if a certain pattern is inside an array. I tried:
myArray.flatten.include?(/myPattern/)
but it always return false. Why? Is it because the "include?" doesn't takes
regular expressions?
Here's another example that I tried inside an irb session:
data = ["TC_TP1", "TC_TP2", "TC_TP3"]
=>["TC_TP1", "TC_TP2", "TC_TP3"]
data.include?(/TC_TP/)
=> false
data.include?(/TC_TP.*/)
=> false
data.include?(/TC_TP1/)
=> false
data.include?("TC_TP1")
=> true !!!
Thanks for your help.