logo       

Re: How to include a string into a regex comparison?: msg#02365

ruby-talk

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<jgabrielygalan@xxxxxxxxx> 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
<ibc@xxxxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise