title: Remove first line from a Text block if it contains a specific string - using jQuery
body: <p>I have a table that has some content in it. Not all rows has same content but some of them will have the first sentence as e.g.</p>
  
  <blockquote>
    <p>Hello, how are you John?</p>
    
    <p>Hello, how are you Mary?</p>
  </blockquote>
  
  <p>Same pattern with different name. </p>
  
  <p>The row will look like below. And the content in the span comes from database. Yes the text with break tags as well.</p>
  
  <pre><code>&lt;tr style="background-color:#F7F7f7"&gt;
  &lt;td&gt;
  &lt;span id="sp1"&gt;Hello How Are you? John &lt;br/&gt;&lt;br/&gt;Some text blalablalalbal &lt;br/&gt;&lt;br/&gt;"You are Awesome" &lt;br/&gt;&lt;br/&gt;----What can I do for you? &lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span id="sp2"&gt;XYZABCD&lt;/span&gt;&lt;br /&gt;
  &lt;span id="sp3"&gt;12345669060 Some Loren ipsum&lt;/span&gt;&lt;br /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I want to remove the first sentence from the rows that has <em>Hello, how are you xyzname?</em>.</p>
  
  <p>So I have the following code that works and does what I want:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $(function () {
              $("#btnCleanUp").click(function () {
                  $("table tr td").each(function () {
                      var elem = $(this).find('span:contains("Hello How Are you?")');
                      var alltxts = elem.contents().filter(function () {
                          var retm = true;
                          var str = this.nodeValue;
                          if (str != null) {
                              var bstr = str.indexOf("Hello How Are you?");
                              $(this).nodeValue = "";
                              if (bstr &gt;= 0) {
                                  retm = false;
                              }
                          }
                          var ret = (this.nodeType == 3) &amp;&amp; retm;
                          return ret;
                      });
                      elem.text("");
                      elem.html("&lt;br/&gt;");
                      $(alltxts).each(function () {
                          var hm = $(this);
                          elem.html(elem.html() + hm[0].nodeValue + "&lt;br/&gt;&lt;br/&gt;");
                      });
                  });
              });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>Here is the sample <a href="http://jsfiddle.net/ZDx4x/" rel="nofollow">demo</a>.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Can I do this in a better way?</p>
  
  <p>I want to simplify the above code block if possible, I mean logic-wise because I think it can be done in a better way given the potential of jquery.</p>
  
  <p>I am open to do this in C# if that's a better way. Please provide sample code.</p>