This is my code
pong = /return/.match(cap.array[0])
if pong == "return"
puts "Pong"
end
cap.array[0] is definitely matching /return/ as you can see when I use pp:
#<MatchData "return">
but for some reason, the if statement isn’t triggering. Any ideas why it won’t match? I tried == and === thinking it could be a type issue, but no joy.
Regex#matchreturns aMatchDataobject. Thus, its comparison to string fails.