From: "Iñaki Baz Castillo" Date: 2009-07-31T18:34:12+09:00 Subject: Re: How to include a string into a regex comparison? 2009/7/31 Iñaki Baz Castillo : > Hi, I don't get solving the following issue (sure it's easy but I cannot do it): > > > valid_content_type      = "application/auth-policy+xml" > received_content_type = "application/auth-policy+xml;charset=ISO-8859-1" > > received_content_type =~ /^application\/auth\-policy\+xml;?/ > => 0 > > received_content_type =~ /^#{received_content_type};?/ > => nil > > How to fix it? Thanks a lot. Solved: received_content_type =~ /^#{Regex.escape(received_content_type)};?/ => 0 -- Iñaki Baz Castillo