I'm using Ruby 2.4. I followed the advice from thsi question -- How to embed regular expressions in other regular expressions in Ruby , but I can't figure out why the expression below isn't matching ...
2.4.0 :021 > TOKENS = ["a", "b"]
=> ["a", "b"]
2.4.0 :022 > str = "B19"
=> "B19"
2.4.0 :023 > str =~ /#{Regexp.union(TOKENS)}/i
=> nil
I've simplified the example so to illustrate my point but I would like to have the reg ex match (as opposed to doing a string.include?)