title: Regular Expression problem in erb Rails
body: <p>I need to apply a regular expression in html.erb</p>
  
  <pre><code>&lt;% taxon_name.strains.each do |strain| %&gt;
  &lt;% taxon_name.strain_appendices.each_with_index do |strain_appendice, i| %&gt;
  &lt;% if ((strain_appendice.data_source =~ /LPSN/) &amp;&amp; (strain.relevance =~ /^ty(.*)ain$/))%&gt;
  &lt;% if i == 0 %&gt;
  &lt;p&gt;&lt;%= strain_appendice.appendix %&gt;  &lt;/p&gt; &lt;% strain.strain_id %&gt; &lt;% strain.relevance %&gt;
  &lt;%else%&gt;
  &lt;%= strain_appendice.appendix %&gt; - &lt;% strain.strain_id %&gt; &lt;% strain.relevance %&gt;
  &lt;%end%&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>This code replaces the all content of a strain.strain_id &amp; strain.relevance and doesnot passes match criteria. Instead of matching it replacing strain.strain_id &amp; strain.relevance contents.</p>
  
  <p>Kindly tell me the way to match and pass conditions.</p>
  
  <p>-- 
  With Regards,</p>
  
  <p>Palani Kannan. K,</p>