I’m sorry if this has been done before, but I can’t seem to find any
I’m trying to search mail messages for headers based on the following:
config = YAML.load_file(‘config.yaml’)
$stdin.each do |line|
puts line if line =~ /^Recevied:/ … line =~ /by
and guess what? It doesn’t work.
If I hard code the hostname it works fine.
But this and /by config[‘hostname’]/ both fail to match.
So, how do you set a variable in a regular expression?
Also, how would I match multiple lines?
I would much rather match something like:
because that will pick up the one Received header I want.
I can write in Perl 5 regex but I’m not as familiar with Ruby’s methods.