From: "Iñaki Baz Castillo" Date: 2009-07-31T18:47:26+09:00 Subject: Re: How to include a string into a regex comparison? El 31 de julio de 2009 11:45, Jesús Gabriel y Galán escribió: > Try this: > > irb(main):001:0> valid_content_type      = "application/auth-policy+xml" > => "application/auth-policy+xml" > irb(main):002:0> received_content_type = > "application/auth-policy+xml;charset=ISO-8859-1" > => "application/auth-policy+xml;charset=ISO-8859-1" > irb(main):005:0> re = /^#{Regexp.escape(valid_content_type)};?/ > => /^application\/auth\-policy\+xml;?/ > irb(main):006:0> received_content_type =~ re > => 0 Thanks to all, the fact is that I already solved the issue doing exactly the same :) I replied to myself in the maillist. Thanks a lot for all your help. -- Iñaki Baz Castillo