title: Regex in YAML file to be compared to hash value in ruby
body: <p>So I'm trying to write a matcher to verify data from within a hash, pulling the definition from a YAML file. It's a little messy right now, but it'll get refactored later. </p>
  
  <p>I want to verify a value is a digit within a hash. I'm able to parse the input files and YAML file.</p>
  
  <p>Here's my YAML</p>
  
  <pre><code>:pmt_sum:
   - Type: NUMBER
   - Expected: !ruby/regexp '/\d*/'
  </code></pre>
  
  <p>Here's the code that's supposed to be doing the checking, it's part of a function that iterates through the hash (<code>header_def</code> is a hash):</p>
  
  <pre><code>header_def.each { |key, value|
      if parsed_hash[0][key] != value[2]["Expected"]
       puts "#{key} value does not match #{value[1]["Expected"]}, it returned #{parsed_hash[0][key]"
      else
       puts "working as intended"
      end
  }
  </code></pre>
  
  <p><code>hash[0][key]</code> would pull out the <code>:pmt_sum</code> key from the input file and output the message if it doesn't match what's in the YAML. This works for anything I hard code, however if I try to use regex, it spits out this: </p>
  
  <pre><code>pmt_sum value does not match (?-mix:\d*), it returned 7
  </code></pre>
  
  <p>Does anyone have tips on passing in regex to a Ruby program from a YAML file?</p>
  
  <p>Edit: Disregard, I fixed it using a case statement to check the class of value[2]["Expected"], and used .match when it's a Regexp. Thanks for the help though!</p>