I’m trying to pass in a string from one function to another to be parsed as a regular expression.
Currently, when I do
@match = run_rule({ "subjectline" => "What is the weather like in Mumbai?", "rule" => "[w|W]hat is the weather( like)? in ([^?]+)?"})
The answer is what I want (matching individual sections of the regular expression).
When I do
@match = run_rule({ "subjectline" => "What is the weather like in Mumbai?", "rule" => rule['rule']['rule']})
where rule is returned from YAML
---
rule:
rule: "[w|W]hat is the weather( like)? in ([^?]+)?"
puts returns exactly the same thing at the console for
puts rule['rule']['rule']
puts "[w|W]hat is the weather( like)? in ([^?]+)?"
What’s going on?
Works perfectly for me, see:
Something else is going on that you’re not showing us.