Having trouble with match wildcards in array
- by Senthil
I've a master text file and exceptions file and I want to match all the words in exception file with master file and increase counter, but the trick is with wildcards.
I'm able to do without wildcards with this:
words = %w(aaa aab acc ccc AAA)
stop = %q(/aa./)
words.each do |x|
if x.match(/aa./)
puts "yes for #{x}"
else
puts "no for #{x}"
end
end
=
yes for aaa
yes for aab
no for acc
no for ccc
yes for AAA
Also which would be the best way to go about this, using arrays or some other way.
Edit: Sorry for the confusion. Yes stop has multiple wildcards and I want to match all words based on those wildcards.
words = %w(aaa aab acc ccc AAA)
stop = %q(aa* ac* ab*)
Thanks